docker_container and docker_network: avoid None errors (#65018)
* Avoid None errors. * Add changelog.
This commit is contained in:
parent
f4d45ffdff
commit
63b94fca7e
3 changed files with 6 additions and 1 deletions
3
changelogs/fragments/65018-docker-none-errors.yml
Normal file
3
changelogs/fragments/65018-docker-none-errors.yml
Normal file
|
@ -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…
Reference in a new issue