From 3eb8142a413c7fd0c87072d05cb21978e9ea9e92 Mon Sep 17 00:00:00 2001 From: Jose Armesto Date: Wed, 17 May 2017 15:17:47 +0200 Subject: [PATCH] [cloud] Fixes #24578: ROLLBACK_COMPLETE is a failure state for CloudFormation module (#24596) * ROLLBACK_COMPLETE is a failure state Fixes #24578 * Adding AWS documentation on Stack status * Fixed comment --- lib/ansible/modules/cloud/amazon/cloudformation.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/ansible/modules/cloud/amazon/cloudformation.py b/lib/ansible/modules/cloud/amazon/cloudformation.py index 0906b542d8..e6321ea033 100644 --- a/lib/ansible/modules/cloud/amazon/cloudformation.py +++ b/lib/ansible/modules/cloud/amazon/cloudformation.py @@ -343,8 +343,10 @@ def stack_operation(cfn, stack_name, operation): else: ret.update({'changed': False, 'failed': True, 'output' : 'Stack not found.'}) return ret - elif stack['StackStatus'].endswith('_ROLLBACK_COMPLETE'): - ret.update({'changed': True, 'failed' :True, 'output': 'Problem with %s. Rollback complete' % operation}) + # it covers ROLLBACK_COMPLETE and UPDATE_ROLLBACK_COMPLETE + # Possible states: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-describing-stacks.html#w1ab2c15c17c21c13 + elif stack['StackStatus'].endswith('ROLLBACK_COMPLETE'): + ret.update({'changed': True, 'failed': True, 'output': 'Problem with %s. Rollback complete' % operation}) return ret # note the ordering of ROLLBACK_COMPLETE and COMPLETE, because otherwise COMPLETE will match both cases. elif stack['StackStatus'].endswith('_COMPLETE'):