mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Purge networks using network name rather than ID. Fixes 4596.
This commit is contained in:
parent
890c2d04e2
commit
05303a974d
1 changed files with 2 additions and 2 deletions
|
@ -1767,9 +1767,9 @@ class ContainerManager(DockerBaseClass):
|
||||||
def _purge_networks(self, container, networks):
|
def _purge_networks(self, container, networks):
|
||||||
for network in networks:
|
for network in networks:
|
||||||
self.results['actions'].append(dict(removed_from_network=network['name']))
|
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:
|
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:
|
except Exception as exc:
|
||||||
self.fail("Error disconnecting container from network %s - %s" % (network['name'],
|
self.fail("Error disconnecting container from network %s - %s" % (network['name'],
|
||||||
str(exc)))
|
str(exc)))
|
||||||
|
|
Loading…
Reference in a new issue