1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Make os_volume idempotent (#24881)

Fix adds idempotency while deleting volume in os_volume
module

Fixes #19619

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
This commit is contained in:
Abhijeet Kasurde 2017-05-24 21:46:23 +05:30 committed by Ricardo Carrillo Cruz
parent a611449cad
commit 625ee36e06

View file

@ -131,14 +131,16 @@ def _present_volume(module, cloud):
def _absent_volume(module, cloud):
try:
cloud.delete_volume(
name_or_id=module.params['display_name'],
wait=module.params['wait'],
timeout=module.params['timeout'])
except shade.OpenStackCloudTimeout:
module.exit_json(changed=False)
module.exit_json(changed=True)
changed = False
if cloud.volume_exists(module.params['display_name']):
try:
changed = cloud.delete_volume(name_or_id=module.params['display_name'],
wait=module.params['wait'],
timeout=module.params['timeout'])
except shade.OpenStackCloudTimeout:
module.exit_json(changed=changed)
module.exit_json(changed=changed)
def main():