From 8ff71a3fa8de36c6ac3a6b52a4cbe3c621b8b793 Mon Sep 17 00:00:00 2001 From: Monty Taylor Date: Wed, 17 Jun 2015 08:47:14 -0400 Subject: [PATCH] Actually use changed variable --- .../modules/cloud/openstack/os_security_group.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/lib/ansible/modules/cloud/openstack/os_security_group.py b/lib/ansible/modules/cloud/openstack/os_security_group.py index 48aed418fa4..0864b83e9e9 100644 --- a/lib/ansible/modules/cloud/openstack/os_security_group.py +++ b/lib/ansible/modules/cloud/openstack/os_security_group.py @@ -115,8 +115,8 @@ def main(): if module.check_mode: module.exit_json(changed=_system_state_change(module, secgroup)) + changed = False if state == 'present': - changed = False if not secgroup: secgroup = cloud.create_security_group(name, description) changed = True @@ -126,14 +126,13 @@ def main(): secgroup['id'], description=description) changed = True module.exit_json( - changed=True, id=secgroup.id, secgroup=secgroup) + changed=changed, id=secgroup.id, secgroup=secgroup) if state == 'absent': - if not secgroup: - module.exit_json(changed=False) - else: + if secgroup: cloud.delete_security_group(secgroup['id']) - module.exit_json(changed=True) + changed=True + module.exit_json(changed=changed) except shade.OpenStackCloudException as e: module.fail_json(msg=e.message)