mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-25 11:51:26 -07:00
Return resource objects from OpenStack modules
It's not uncommon for people to want to do additional things after creating a module. Also, add a note about it to the dev notes.
This commit is contained in:
parent
89f95471f8
commit
b955b2f5c8
7 changed files with 30 additions and 22 deletions
|
@ -227,7 +227,7 @@ def main():
|
|||
dns_nameservers=dns,
|
||||
allocation_pools=pool,
|
||||
host_routes=host_routes)
|
||||
module.exit_json(changed=True, result="created")
|
||||
changed = True
|
||||
else:
|
||||
if _needs_update(subnet, module):
|
||||
cloud.update_subnet(subnet['id'],
|
||||
|
@ -237,16 +237,18 @@ def main():
|
|||
dns_nameservers=dns,
|
||||
allocation_pools=pool,
|
||||
host_routes=host_routes)
|
||||
module.exit_json(changed=True, result="updated")
|
||||
changed = True
|
||||
else:
|
||||
module.exit_json(changed=False, result="success")
|
||||
changed = False
|
||||
module.exit_json(changed=changed)
|
||||
|
||||
elif state == 'absent':
|
||||
if not subnet:
|
||||
module.exit_json(changed=False, result="success")
|
||||
changed = False
|
||||
else:
|
||||
changed = True
|
||||
cloud.delete_subnet(subnet_name)
|
||||
module.exit_json(changed=True, result="deleted")
|
||||
module.exit_json(changed=changed)
|
||||
|
||||
except shade.OpenStackCloudException as e:
|
||||
module.fail_json(msg=e.message)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue