Fix ECS ServicesStable waiter when deployments key is absent#3632
Fix ECS ServicesStable waiter when deployments key is absent#3632veeceey wants to merge 1 commit intoboto:developfrom
Conversation
| Friendly ping - any chance someone could take a look at this when they get a chance? Happy to make any changes if needed. |
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
1bcfc27 to 1be7648 Compare | hi there, just following up — let me know if I should make any changes on this |
| Hi @veeceey, Thank you for your PR. We explain a bit more in our contribution guide, but all of the files in the data folder aren't able to be edited directly in botocore. These files are owned by the service team and submitted to all SDKs, not just botocore. @adev-code , could you take a look at this and contact the service team so we can get this confirmed and fixed upstream? |
| I've raised this issue to the service team for them to address upstream. Ticket # for internal use : P397024257 |
| Thanks @SamRemis and @RyanFitzSimmonsAK — appreciate you flagging this to the service team. Makes total sense that the data files are generated upstream. I'll keep an eye on the ticket and happy to help if there's anything else needed on this end. |
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).