Check if enabled_snat is set in modules arguments (#46754)

If `enabled_snat` is not set at all in module arguments but Neutron
policy sets it by default in Openstack, then `os_router` will attempt to
recreate otherwise perfectly good router.

Follow up for https://github.com/ansible/ansible/issues/44432#issuecomment-428531031
This commit is contained in:
Michał Siemek 2018-10-30 13:04:43 +01:00 committed by ansibot
parent eb39c461ce
commit c2b7174d31

View file

@ -227,8 +227,10 @@ def _needs_update(cloud, module, router, network, internal_subnet_ids, internal_
if router['admin_state_up'] != module.params['admin_state_up']:
return True
if router['external_gateway_info']:
if router['external_gateway_info'].get('enable_snat', True) != module.params['enable_snat']:
return True
# check if enable_snat is set in module params
if module.params['enable_snat'] is not None:
if router['external_gateway_info'].get('enable_snat', True) != module.params['enable_snat']:
return True
if network:
if not router['external_gateway_info']:
return True