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
This commit is contained in:
Miguel Duarte Barroso 2018-12-20 12:49:52 +01:00 committed by John R Barker
commit 4951e5a5b7
2 changed files with 5 additions and 1 deletions

View file

@ -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)

View file

@ -359,7 +359,7 @@ def main():
cloud.delete_security_group_rule(rule['id']) cloud.delete_security_group_rule(rule['id'])
changed = True changed = True
module.exit_json(changed=changed) module.exit_json(changed=changed)
except sdk.exceptions.OpenStackCloudException as e: except sdk.exceptions.OpenStackCloudException as e:
module.fail_json(msg=str(e)) module.fail_json(msg=str(e))