Fix network alias and network link comparison.

- Using set based comparison was not working consistently
  - With != operator worked locally but consistently failed on Travis
  - With 'not in' operator failed locally and on Travis
reviewable/pr18780/r1
chouseknecht 8 years ago
parent 89916af2a5
commit e7abbbf134

@ -1373,7 +1373,8 @@ class Container(DockerBaseClass):
if network.get('aliases') and not connected_networks[network['name']].get('Aliases'):
diff = True
if network.get('aliases') and connected_networks[network['name']].get('Aliases'):
if set(network.get('aliases')) != set(connected_networks[network['name']].get('Aliases')):
for alias in network.get('aliases'):
if alias not in connected_networks[network['name']].get('Aliases', []):
diff = True
if network.get('links') and not connected_networks[network['name']].get('Links'):
diff = True
@ -1381,7 +1382,8 @@ class Container(DockerBaseClass):
expected_links = []
for link, alias in network['links'].iteritems():
expected_links.append("%s:%s" % (link, alias))
if set(expected_links) != set(connected_networks[network['name']].get('Links', [])):
for link in expected_links:
if link not in connected_networks[network['name']].get('Links', []):
diff = True
if diff:
different = True

Loading…
Cancel
Save