Fix ECS ServicesStable waiter when deployments key is absent#3632
Open
veeceey wants to merge 2 commits intoboto:developfrom
Open
Fix ECS ServicesStable waiter when deployments key is absent#3632veeceey wants to merge 2 commits intoboto:developfrom
veeceey wants to merge 2 commits intoboto:developfrom
Conversation
When a service is deployed using CodeDeploy Blue/Green, the DescribeServices response may not include a `deployments` field. The `length(deployments)` call in the JMESPath expression then receives null, causing a JMESPathTypeError. Use `deployments || `[]`` to default to an empty array when the field is absent, so `length()` always receives a valid input. A service without deployments will have length 0 (not equal to 1), so it is correctly treated as not yet stable. Fixes boto#3314
Author
|
Friendly ping - any chance someone could take a look at this when they get a chance? Happy to make any changes if needed. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #3314
The
ServicesStablewaiter crashes with aJMESPathTypeErrorwhen theDescribeServicesresponse doesn't include adeploymentsfield for aservice. This can happen when a service is deployed using CodeDeploy's
Blue/Green deployment strategy.
The root cause is the JMESPath expression
length(deployments)receivingnullwhen the key is absent. I've changed it tolength(deployments ||[])so it falls back to an empty array. A service without deployments will have
length 0 (not 1), so it's correctly treated as not yet stable and the waiter
retries instead of blowing up.
Testing
Added functional tests in
tests/functional/test_ecs.pycovering:deploymentskey (previously crashed, now retries)All existing waiter config lint tests continue to pass (
tests/functional/test_waiter_config.py— 148 tests).