* 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
(cherry picked from commit c2b7174d31
)
* Add changelog entry
This commit is contained in:
parent
01c0a6d699
commit
951572bec1
2 changed files with 9 additions and 2 deletions
5
changelogs/fragments/os_router_enable_snat_fix.yaml
Normal file
5
changelogs/fragments/os_router_enable_snat_fix.yaml
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
bugfixes:
|
||||||
|
- Fixed an issue where ``os_router`` would attempt to recreate router,
|
||||||
|
because lack of ``enabled_snat`` parameter was treated as difference,
|
||||||
|
if default Neutron policy for snat is set. (https://github.com/ansible/ansible/issues/29903)
|
|
@ -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']:
|
if router['admin_state_up'] != module.params['admin_state_up']:
|
||||||
return True
|
return True
|
||||||
if router['external_gateway_info']:
|
if router['external_gateway_info']:
|
||||||
if router['external_gateway_info'].get('enable_snat', True) != module.params['enable_snat']:
|
# check if enable_snat is set in module params
|
||||||
return True
|
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 network:
|
||||||
if not router['external_gateway_info']:
|
if not router['external_gateway_info']:
|
||||||
return True
|
return True
|
||||||
|
|
Loading…
Reference in a new issue