From 76260d3aa88856add595c40b9485d363f7d6595b Mon Sep 17 00:00:00 2001 From: chouseknecht Date: Fri, 12 Aug 2016 17:57:32 -0400 Subject: [PATCH] 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 --- lib/ansible/modules/cloud/docker/docker_container.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/ansible/modules/cloud/docker/docker_container.py b/lib/ansible/modules/cloud/docker/docker_container.py index e44b1b00214..0c7a77a19af 100644 --- a/lib/ansible/modules/cloud/docker/docker_container.py +++ b/lib/ansible/modules/cloud/docker/docker_container.py @@ -1373,16 +1373,18 @@ 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')): - diff = True + 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 if network.get('links') and connected_networks[network['name']].get('Links'): 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', [])): - diff = True + for link in expected_links: + if link not in connected_networks[network['name']].get('Links', []): + diff = True if diff: different = True differences.append(dict(