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