Make sure we're always returning objects too
This commit is contained in:
parent
072110c757
commit
73cb529d2c
1 changed files with 8 additions and 8 deletions
|
@ -115,24 +115,24 @@ def main():
|
||||||
if module.check_mode:
|
if module.check_mode:
|
||||||
module.exit_json(changed=_system_state_change(module, secgroup))
|
module.exit_json(changed=_system_state_change(module, secgroup))
|
||||||
|
|
||||||
|
changed = False
|
||||||
if state == 'present':
|
if state == 'present':
|
||||||
if not secgroup:
|
if not secgroup:
|
||||||
secgroup = cloud.create_security_group(name, description)
|
secgroup = cloud.create_security_group(name, description)
|
||||||
module.exit_json(changed=True, id=secgroup['id'])
|
changed = True
|
||||||
else:
|
else:
|
||||||
if _needs_update(module, secgroup):
|
if _needs_update(module, secgroup):
|
||||||
secgroup = cloud.update_security_group(
|
secgroup = cloud.update_security_group(
|
||||||
secgroup['id'], description=description)
|
secgroup['id'], description=description)
|
||||||
module.exit_json(changed=True, id=secgroup['id'])
|
changed = True
|
||||||
else:
|
module.exit_json(
|
||||||
module.exit_json(changed=False, id=secgroup['id'])
|
changed=changed, id=secgroup['id'], secgroup=secgroup)
|
||||||
|
|
||||||
if state == 'absent':
|
if state == 'absent':
|
||||||
if not secgroup:
|
if secgroup:
|
||||||
module.exit_json(changed=False)
|
|
||||||
else:
|
|
||||||
cloud.delete_security_group(secgroup['id'])
|
cloud.delete_security_group(secgroup['id'])
|
||||||
module.exit_json(changed=True)
|
changed = True
|
||||||
|
module.exit_json(changed=changed)
|
||||||
|
|
||||||
except shade.OpenStackCloudException as e:
|
except shade.OpenStackCloudException as e:
|
||||||
module.fail_json(msg=e.message)
|
module.fail_json(msg=e.message)
|
||||||
|
|
Loading…
Reference in a new issue