mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-06 13:22:48 +00:00
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".
This commit is contained in:
@@ -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':
|
||||
|
||||
Reference in New Issue
Block a user