mirror of
https://github.com/docker/compose.git
synced 2025-07-29 00:24:12 +02:00
Fix config hash consistency with unprioritized networks
Signed-off-by: Joffrey F <joffrey@docker.com>
This commit is contained in:
parent
541fb65259
commit
707e21183f
@ -323,7 +323,12 @@ def get_networks(service_dict, network_definitions):
|
|||||||
'Service "{}" uses an undefined network "{}"'
|
'Service "{}" uses an undefined network "{}"'
|
||||||
.format(service_dict['name'], name))
|
.format(service_dict['name'], name))
|
||||||
|
|
||||||
return OrderedDict(sorted(
|
if any([v.get('priority') for v in networks.values()]):
|
||||||
networks.items(),
|
return OrderedDict(sorted(
|
||||||
key=lambda t: t[1].get('priority') or 0, reverse=True
|
networks.items(),
|
||||||
))
|
key=lambda t: t[1].get('priority') or 0, reverse=True
|
||||||
|
))
|
||||||
|
else:
|
||||||
|
# Ensure Compose will pick a consistent primary network if no
|
||||||
|
# priority is set
|
||||||
|
return OrderedDict(sorted(networks.items(), key=lambda t: t[0]))
|
||||||
|
@ -701,9 +701,11 @@ class ServiceTest(unittest.TestCase):
|
|||||||
image='example.com/foo',
|
image='example.com/foo',
|
||||||
client=self.mock_client,
|
client=self.mock_client,
|
||||||
network_mode=NetworkMode('bridge'),
|
network_mode=NetworkMode('bridge'),
|
||||||
networks={'bridge': {}},
|
networks={'bridge': {}, 'net2': {}},
|
||||||
links=[(Service('one', client=self.mock_client), 'one')],
|
links=[(Service('one', client=self.mock_client), 'one')],
|
||||||
volumes_from=[VolumeFromSpec(Service('two', client=self.mock_client), 'rw', 'service')]
|
volumes_from=[VolumeFromSpec(Service('two', client=self.mock_client), 'rw', 'service')],
|
||||||
|
volumes=[VolumeSpec('/ext', '/int', 'ro')],
|
||||||
|
build={'context': 'some/random/path'},
|
||||||
)
|
)
|
||||||
config_hash = service.config_hash
|
config_hash = service.config_hash
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user