From 9a2e192e8a2fe8ffd9ff415cf0b1cbdfdca6306f Mon Sep 17 00:00:00 2001 From: Dominik Holler Date: Wed, 10 Oct 2018 16:01:45 +0200 Subject: [PATCH] Fix os_router ignores enable_snat: no (#45921) If enable_snat is False, this should be used to build the request, because the default value in the OpenStack Networking API is True. Fixes the issue #45915. (cherry picked from commit 452a4ab78118966189eeedbd3523bf6559f061b2) --- changelogs/fragments/45921-os_router-ignores-enable_snat-no.yml | 2 ++ lib/ansible/modules/cloud/openstack/os_router.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/45921-os_router-ignores-enable_snat-no.yml diff --git a/changelogs/fragments/45921-os_router-ignores-enable_snat-no.yml b/changelogs/fragments/45921-os_router-ignores-enable_snat-no.yml new file mode 100644 index 0000000000..7ffeb5e43e --- /dev/null +++ b/changelogs/fragments/45921-os_router-ignores-enable_snat-no.yml @@ -0,0 +1,2 @@ +bugfixes: + - "os_router - ``enable_snat: no`` was ignored." diff --git a/lib/ansible/modules/cloud/openstack/os_router.py b/lib/ansible/modules/cloud/openstack/os_router.py index 763098c7b5..643215028b 100644 --- a/lib/ansible/modules/cloud/openstack/os_router.py +++ b/lib/ansible/modules/cloud/openstack/os_router.py @@ -306,7 +306,7 @@ def _build_kwargs(cloud, module, router, network): if network: kwargs['ext_gateway_net_id'] = network['id'] # can't send enable_snat unless we have a network - if module.params['enable_snat']: + if module.params.get('enable_snat') is not None: kwargs['enable_snat'] = module.params['enable_snat'] if module.params['external_fixed_ips']: