Skip to content
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

[Resolve #1483] Handle errors in change sets #1486

Merged
merged 6 commits into from
Aug 3, 2024

Conversation

alex-harvey-z3q
Copy link
Contributor

@alex-harvey-z3q alex-harvey-z3q commented Jul 6, 2024

Description

This adds code to handle the case of failures in stack groups that have missing or errored stacks when creating, describing and executing change-sets.

Before this, any stack group that contained a stack that had been deleted, or had errored out, resulted in all change set operations on that stack group failing.

The reason for this is no error or exception handling had ever been added for change sets, but assumed all stacks in the stack group were clean and could respond to the change set APIs.

For example, deleting change sets might error out with:

% sceptre delete -y network.yaml sceptre-network
The Change Set will be delete on the following stacks, if applicable:
network

"An error occurred (ValidationError) when calling the DeleteChangeSet
operation: Stack [test-e2e-direct-connect] does not exist"

This is particularly an issue for sites that employ as best practice analysis of change sets for safety prior to launching updates.

This patch adds the missing error handling for delete_change_set, create_change_set, describe_change_set and
execute_change_set.

Testing

I have tested this locally using a stack group with 4 stacks. I deleted one of these stacks. Then:

delete_change_set:
Screenshot 2024-07-06 at 5 17 56 pm

create_change_set:
Screenshot 2024-07-06 at 5 18 29 pm

describe_change_set:
Screenshot 2024-07-06 at 5 21 12 pm

Now I delete that stack/change-set again and rerun:
Screenshot 2024-07-06 at 5 22 32 pm

Create again and then:

_execute_change_set:
Screenshot 2024-07-06 at 5 24 00 pm

Note that I did this testing on the release branch which included
#1480

PR Checklist

  • Wrote a good commit message & description [see guide below].
  • Commit message starts with [Resolve #issue-number].
  • Added/Updated unit tests.
  • Added/Updated integration tests (if applicable).
  • All unit tests (poetry run tox) are passing.
  • Used the same coding conventions as the rest of the project.
  • The new code passes pre-commit validations (poetry run pre-commit run --all-files).
  • The PR relates to only one subject with a clear title.
    and description in grammatically correct, complete sentences.

Approver/Reviewer Checklist

  • Before merge squash related commits.

Other Information

Guide to writing a good commit

This adds code to handle the case of failures in stack groups that have
missing or errored stacks when creating, describing and executing
change-sets.

Before this, any stack group that contained a stack that had been
deleted, or had errored out, resulted in all change set operations on
that stack group failing.

The reason for this is no error or exception handling had ever been
added for change sets, but assumed all stacks in the stack group were
clean and could respond to the change set APIs.

For example, deleting change sets might error out with:

```
% sceptre delete -y network.yaml sceptre-network
The Change Set will be delete on the following stacks, if applicable:
network

"An error occurred (ValidationError) when calling the DeleteChangeSet
operation: Stack [test-e2e-direct-connect] does not exist"
```

This is particularly an issue for sites that employ as best practice
analysis of change sets for safety prior to launching updates.

This patch adds the missing error handling for `delete_change_set`,
`create_change_set`, `describe_change_set` and
`execute_change_set`.
@alex-harvey-z3q
Copy link
Contributor Author

sceptre/plan/actions.py Outdated Show resolved Hide resolved
sceptre/plan/actions.py Outdated Show resolved Hide resolved
sceptre/plan/actions.py Show resolved Hide resolved
sceptre/plan/actions.py Show resolved Hide resolved
sceptre/plan/actions.py Outdated Show resolved Hide resolved
@alex-harvey-z3q alex-harvey-z3q merged commit deef08e into Sceptre:master Aug 3, 2024
11 checks passed
@alex-harvey-z3q alex-harvey-z3q deleted the ah/1483-change-sets branch August 3, 2024 04:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants