From 05303a974d2f75c2d474e12a4b21df74c74a02d0 Mon Sep 17 00:00:00 2001 From: Chris Houseknecht Date: Sat, 10 Sep 2016 00:45:51 -0400 Subject: [PATCH] Purge networks using network name rather than ID. Fixes 4596. --- lib/ansible/modules/cloud/docker/docker_container.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/ansible/modules/cloud/docker/docker_container.py b/lib/ansible/modules/cloud/docker/docker_container.py index f571cd25c9c..fa54dc63c03 100644 --- a/lib/ansible/modules/cloud/docker/docker_container.py +++ b/lib/ansible/modules/cloud/docker/docker_container.py @@ -1767,9 +1767,9 @@ class ContainerManager(DockerBaseClass): def _purge_networks(self, container, networks): for network in networks: self.results['actions'].append(dict(removed_from_network=network['name'])) - if not self.check_mode and network.get('id'): + if not self.check_mode: try: - self.client.disconnect_container_from_network(container.Id, network['id']) + self.client.disconnect_container_from_network(container.Id, network['name']) except Exception as exc: self.fail("Error disconnecting container from network %s - %s" % (network['name'], str(exc)))