mirror of https://github.com/docker/compose.git
Remove external_name from serialized config output
Signed-off-by: Joffrey F <joffrey@docker.com>
This commit is contained in:
parent
ca3aef0c84
commit
ea640f3821
|
@ -27,11 +27,15 @@ def serialize_config(config):
|
||||||
service_dict.pop('name'): service_dict
|
service_dict.pop('name'): service_dict
|
||||||
for service_dict in denormalized_services
|
for service_dict in denormalized_services
|
||||||
}
|
}
|
||||||
|
networks = config.networks.copy()
|
||||||
|
for net_name, net_conf in networks.items():
|
||||||
|
if 'external_name' in net_conf:
|
||||||
|
del net_conf['external_name']
|
||||||
|
|
||||||
output = {
|
output = {
|
||||||
'version': V2_0,
|
'version': V2_0,
|
||||||
'services': services,
|
'services': services,
|
||||||
'networks': config.networks,
|
'networks': networks,
|
||||||
'volumes': config.volumes,
|
'volumes': config.volumes,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -224,6 +224,20 @@ class CLITestCase(DockerClientTestCase):
|
||||||
'volumes': {},
|
'volumes': {},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def test_config_external_network(self):
|
||||||
|
self.base_dir = 'tests/fixtures/networks'
|
||||||
|
result = self.dispatch(['-f', 'external-networks.yml', 'config'])
|
||||||
|
json_result = yaml.load(result.stdout)
|
||||||
|
assert 'networks' in json_result
|
||||||
|
assert json_result['networks'] == {
|
||||||
|
'networks_foo': {
|
||||||
|
'external': True # {'name': 'networks_foo'}
|
||||||
|
},
|
||||||
|
'bar': {
|
||||||
|
'external': {'name': 'networks_bar'}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
def test_config_v1(self):
|
def test_config_v1(self):
|
||||||
self.base_dir = 'tests/fixtures/v1-config'
|
self.base_dir = 'tests/fixtures/v1-config'
|
||||||
result = self.dispatch(['config'])
|
result = self.dispatch(['config'])
|
||||||
|
|
Loading…
Reference in New Issue