Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Add more detail in cloudformation stack deploy failure #8289

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 10, 2023

Conversation

simonrw
Copy link
Contributor

@simonrw simonrw commented May 9, 2023

Motivation

If a stack fails to deploy, it currently shows a helpful "assertion failed: False" error message. This does not explain why the stack failed to deploy.

Changes

This PR adds the following information to an exception thrown by the fixture:

  • the output of describe_stacks on the stack, and
  • the stack events as this often shows the actual source of the error.

Before

E       AssertionError: assert False
E        +  where False = wait_until(<function is_change_set_finished.<locals>._is_change_set_finished.<locals>._inner at 0x7f789e8d1750>, _max_wait=(None or 60))
E        +    where <function is_change_set_finished.<locals>._is_change_set_finished.<locals>._inner at 0x7f789e8d1750> = <function is_change_set_finished.<locals>._is_change_set_finished at 0x7f78b2ed1000>('arn:aws:cloudformation:us-east-1:000000000000:changeSet/change-set-06b2e514/47987e23')

After

>           raise StackDeployError(describe_stack_res, events)
E           localstack.testing.pytest.fixtures.StackDeployError: Stack deploy failed - describe output: {'StackId': 'arn:aws:cloudformation:us-east-1:000000000000:stack/stack-0022f874/2a2b5e0b', 'StackName': 'stack-0022f874', 'ChangeSetId': 'arn:aws:cloudformation:us-east-1:000000000000:changeSet/change-set-5c97fde1/a6d1a8c8', 'Description': 'Test stack', 'CreationTime': datetime.datetime(2023, 5, 10, 9, 13, 15, 915000, tzinfo=tzutc()), 'LastUpdatedTime': datetime.datetime(2023, 5, 10, 9, 13, 15, 915000, tzinfo=tzutc()), 'RollbackConfiguration': {}, 'StackStatus': 'CREATE_FAILED', 'StackStatusReason': 'Deployment failed', 'DisableRollback': False, 'NotificationARNs': [], 'Capabilities': ['CAPABILITY_AUTO_EXPAND', 'CAPABILITY_IAM', 'CAPABILITY_NAMED_IAM'], 'Tags': [], 'EnableTerminationProtection': False, 'DriftInformation': {'StackDriftStatus': 'NOT_CHECKED'}} events: [{'StackId': 'arn:aws:cloudformation:us-east-1:000000000000:stack/stack-0022f874/2a2b5e0b', 'EventId': '48d339c2-0caa-4705-9c83-1c22642adec1', 'StackName': 'stack-0022f874', 'LogicalResourceId': 'stack-0022f874', 'PhysicalResourceId': 'arn:aws:cloudformation:us-east-1:000000000000:stack/stack-0022f874/2a2b5e0b', 'ResourceType': 'AWS::CloudFormation::Stack', 'Timestamp': datetime.datetime(2023, 5, 10, 9, 13, 16, 367000, tzinfo=tzutc()), 'ResourceStatus': 'CREATE_FAILED'}, {'StackId': 'arn:aws:cloudformation:us-east-1:000000000000:stack/stack-0022f874/2a2b5e0b', 'EventId': 'f7eb4d27-9c59-4f1b-987e-e19a2396d032', 'StackName': 'stack-0022f874', 'LogicalResourceId': 'stack-0022f874', 'PhysicalResourceId': 'arn:aws:cloudformation:us-east-1:000000000000:stack/stack-0022f874/2a2b5e0b', 'ResourceType': 'AWS::CloudFormation::Stack', 'Timestamp': datetime.datetime(2023, 5, 10, 9, 13, 15, 934000, tzinfo=tzutc()), 'ResourceStatus': 'CREATE_IN_PROGRESS'}, {'StackId': 'arn:aws:cloudformation:us-east-1:000000000000:stack/stack-0022f874/2a2b5e0b', 'EventId': '55083b4c-60e9-4189-9d55-50ccc06c5ce6', 'StackName': 'stack-0022f874', 'LogicalResourceId': 'stack-0022f874', 'PhysicalResourceId': 'arn:aws:cloudformation:us-east-1:000000000000:stack/stack-0022f874/2a2b5e0b', 'ResourceType': 'AWS::CloudFormation::Stack', 'Timestamp': datetime.datetime(2023, 5, 10, 9, 13, 15, 915000, tzinfo=tzutc()), 'ResourceStatus': 'REVIEW_IN_PROGRESS'}]

@simonrw simonrw requested a review from dominikschubert as a code owner May 9, 2023 21:01
@simonrw simonrw self-assigned this May 9, 2023
@simonrw simonrw added the semver: patch Non-breaking changes which can be included in patch releases label May 9, 2023
@github-actions
Copy link

github-actions bot commented May 9, 2023

LocalStack Community integration with Pro

2 034 tests   1 753 ✔️  1h 23m 55s ⏱️
       2 suites     281 💤
       2 files           0

Results for commit 9852c8b.

♻️ This comment has been updated with latest results.

Copy link
Member

@dominikschubert dominikschubert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@coveralls
Copy link

Coverage Status

Coverage: 82.236% (-0.02%) from 82.261% when pulling 9852c8b on cfn/increased-stack-failure-details into e56f131 on master.

@simonrw simonrw merged commit b693f51 into master May 10, 2023
@simonrw simonrw deleted the cfn/increased-stack-failure-details branch May 10, 2023 10:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver: patch Non-breaking changes which can be included in patch releases
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants