mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-26 20:31:27 -07:00
attempt to fix check mode when state='absent'
This commit is contained in:
parent
10cae0acb3
commit
ec6e75f1cc
1 changed files with 17 additions and 19 deletions
|
@ -127,6 +127,7 @@ def main():
|
||||||
if state == 'absent':
|
if state == 'absent':
|
||||||
if key:
|
if key:
|
||||||
'''found a match, delete it'''
|
'''found a match, delete it'''
|
||||||
|
if not module.check_mode:
|
||||||
try:
|
try:
|
||||||
key.delete()
|
key.delete()
|
||||||
if wait:
|
if wait:
|
||||||
|
@ -141,11 +142,8 @@ def main():
|
||||||
module.fail_json(msg="timed out while waiting for the key to be removed")
|
module.fail_json(msg="timed out while waiting for the key to be removed")
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
module.fail_json(msg="Unable to delete key pair '%s' - %s" % (key, e))
|
module.fail_json(msg="Unable to delete key pair '%s' - %s" % (key, e))
|
||||||
else:
|
|
||||||
key = None
|
key = None
|
||||||
changed = True
|
changed = True
|
||||||
else:
|
|
||||||
'''no match found, no changes required'''
|
|
||||||
|
|
||||||
# Ensure requested key is present
|
# Ensure requested key is present
|
||||||
elif state == 'present':
|
elif state == 'present':
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue