Merge pull request #1740 from bcoca/ec2_key_check_fix

attempt to fix check mode when state='absent'
This commit is contained in:
Brian Coca 2015-07-18 23:13:03 -04:00
commit 5fcc0be25b

View file

@ -127,6 +127,7 @@ def main():
if state == 'absent':
if key:
'''found a match, delete it'''
if not module.check_mode:
try:
key.delete()
if wait:
@ -141,11 +142,8 @@ def main():
module.fail_json(msg="timed out while waiting for the key to be removed")
except Exception, e:
module.fail_json(msg="Unable to delete key pair '%s' - %s" % (key, e))
else:
key = None
changed = True
else:
'''no match found, no changes required'''
# Ensure requested key is present
elif state == 'present':