Actually use changed variable

This commit is contained in:
Monty Taylor 2015-06-17 08:47:14 -04:00
parent 1a11f07d29
commit d8c51a67f3

View file

@ -114,8 +114,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
@ -125,14 +125,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)