From 6c612c9e6c053e1c8a387ed02bab4bd88b7342ac Mon Sep 17 00:00:00 2001 From: hansmi Date: Fri, 19 Oct 2018 20:16:05 +0100 Subject: [PATCH] gluster_volume: Avoid error when deleting non-existent volume (#42097) When a non-existent Gluster volume is to be deleted, i.e.: gluster_volume: state: absent name: vol1-does-not-exist the "gluster_volume" module would always fail with "volume not found vol1-does-not-exist". The reason is that the code checked whether the state is "delete", a value which isn't accepted for the "state" parameter. Instead the expected value for volume deletion is, as above, "absent". --- lib/ansible/modules/storage/glusterfs/gluster_volume.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ansible/modules/storage/glusterfs/gluster_volume.py b/lib/ansible/modules/storage/glusterfs/gluster_volume.py index b13d0189d9d..2ded4d03e6a 100644 --- a/lib/ansible/modules/storage/glusterfs/gluster_volume.py +++ b/lib/ansible/modules/storage/glusterfs/gluster_volume.py @@ -499,7 +499,7 @@ def main(): else: module.fail_json(msg='failed to create volume %s' % volume_name) - if action != 'delete' and volume_name not in volumes: + if action != 'absent' and volume_name not in volumes: module.fail_json(msg='volume not found %s' % volume_name) if action == 'started':