docker_container and docker_network: avoid None errors (#65018)

* Avoid None errors.

* Add changelog.
pull/65236/head
Felix Fontein 5 years ago committed by ansibot
parent f4d45ffdff
commit 63b94fca7e

@ -0,0 +1,3 @@
bugfixes:
- "docker_container - fix network idempotence comparison error."
- "docker_network - fix idempotence comparison error."

@ -2284,7 +2284,7 @@ class Container(DockerBaseClass):
))
else:
diff = False
network_info_ipam = network_info.get('IPAMConfig', {})
network_info_ipam = network_info.get('IPAMConfig') or {}
if network.get('ipv4_address') and network['ipv4_address'] != network_info_ipam.get('IPv4Address'):
diff = True
if network.get('ipv6_address') and network['ipv6_address'] != network_info_ipam.get('IPv6Address'):

@ -562,6 +562,8 @@ class DockerNetworkManager(object):
self.results['changed'] = True
def is_container_connected(self, container_name):
if not self.existing_network:
return False
return container_name in container_names_in_network(self.existing_network)
def connect_containers(self):

Loading…
Cancel
Save