From 4951e5a5b716766936af9d1d01f26a7dcfc43066 Mon Sep 17 00:00:00 2001 From: Miguel Duarte Barroso <39051226+maiqueb@users.noreply.github.com> Date: Thu, 20 Dec 2018 12:49:52 +0100 Subject: [PATCH] os_security_group_rule proper module exit (#50076) When the security group the rule belongs to does not exist and the state is absent, the module is not properly exited, leading to a playbook execution failure. Fixes issue #50057 --- .../fragments/50076-os-sec-group-rule-proper-module-exit.yaml | 4 ++++ lib/ansible/modules/cloud/openstack/os_security_group_rule.py | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/50076-os-sec-group-rule-proper-module-exit.yaml diff --git a/changelogs/fragments/50076-os-sec-group-rule-proper-module-exit.yaml b/changelogs/fragments/50076-os-sec-group-rule-proper-module-exit.yaml new file mode 100644 index 00000000000..2fd579a19ae --- /dev/null +++ b/changelogs/fragments/50076-os-sec-group-rule-proper-module-exit.yaml @@ -0,0 +1,4 @@ +bugfixes: + - os_security_group_rule - os_security_group_rule doesn't exit properly when + secgroup doesn't exist and state=absent + (https://github.com/ansible/ansible/issues/50057) diff --git a/lib/ansible/modules/cloud/openstack/os_security_group_rule.py b/lib/ansible/modules/cloud/openstack/os_security_group_rule.py index b932617969a..af5e1b8a44f 100644 --- a/lib/ansible/modules/cloud/openstack/os_security_group_rule.py +++ b/lib/ansible/modules/cloud/openstack/os_security_group_rule.py @@ -359,7 +359,7 @@ def main(): cloud.delete_security_group_rule(rule['id']) changed = True - module.exit_json(changed=changed) + module.exit_json(changed=changed) except sdk.exceptions.OpenStackCloudException as e: module.fail_json(msg=str(e))