From d26bb2eb4120e25affaed47a56321d7a13bba465 Mon Sep 17 00:00:00 2001 From: Michael Pappas Date: Wed, 30 Mar 2016 14:48:20 -0400 Subject: [PATCH] Prevent ec2group from deleting sgs during check_mode runs --- cloud/amazon/ec2_group.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cloud/amazon/ec2_group.py b/cloud/amazon/ec2_group.py index 51bbb0eec68..ceaa7cd7614 100644 --- a/cloud/amazon/ec2_group.py +++ b/cloud/amazon/ec2_group.py @@ -285,7 +285,8 @@ def main(): if group: '''found a match, delete it''' try: - group.delete() + if not module.check_mode: + group.delete() except Exception as e: module.fail_json(msg="Unable to delete security group '%s' - %s" % (group, e)) else: