Skip to content

Commit

Permalink
Fix network DNS enable idempotency issue (#650)
Browse files Browse the repository at this point in the history
Signed-off-by: Sagi Shnaidman <[email protected]>
  • Loading branch information
sshnaidm authored Sep 28, 2023
1 parent 2a8aaf4 commit a1a667b
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions plugins/modules/podman_network.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,6 @@ def __init__(self, module, podman_version):
self.version = podman_version
self.defaults = {
'driver': 'bridge',
'disable_dns': False,
'internal': False,
'ipv6': False
}
Expand Down Expand Up @@ -332,8 +331,15 @@ def _diff_update_and_compare(self, param_name, before, after):
def diffparam_disable_dns(self):
# For v3 it's impossible to find out DNS settings.
if LooseVersion(self.version) >= LooseVersion('4.0.0'):
before = not self.info.get('dns_enabled', True)
if self.info.get('driver') == 'bridge':
before = not self.info.get('dns_enabled', True)
# for all other drivers except bridge DNS is disabled by default
else:
before = False
after = self.params['disable_dns']
# compare only if set explicitly
if self.params['disable_dns'] is None:
after = before
return self._diff_update_and_compare('disable_dns', before, after)
before = after = self.params['disable_dns']
return self._diff_update_and_compare('disable_dns', before, after)
Expand Down

0 comments on commit a1a667b

Please sign in to comment.