Fix ImageDeleted/ImageVersionDeleted waiters matching wrong error shape (fixes #3782) - #3787
Open
agu2347 wants to merge 1 commit into
Open
Conversation
…pe (boto#3782) The sagemaker DescribeImage and DescribeImageVersion operations declare ResourceNotFound as their error shape (per service-2.json's 'errors' list for each operation) -- there is no ResourceNotFoundException shape anywhere in this service's model. The ImageDeleted and ImageVersionDeleted waiters, however, matched their success acceptor against 'ResourceNotFoundException', a name that never appears in any real response from these operations. As a result, once an image (or image version) was actually deleted and DescribeImage/DescribeImageVersion started returning the real ResourceNotFound error, none of the acceptors matched, so the waiter fell through to raising a WaiterError instead of recognizing the deletion as successful. Fix both waiters to match on the shape name the operations actually declare and return: ResourceNotFound. Added regression tests using Stubber to confirm both waiters treat a ResourceNotFound error as success.
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 #3782.
The
sagemakerDescribeImageandDescribeImageVersionoperations declareResourceNotFoundas their error shape (see each operation'serrorslist inbotocore/data/sagemaker/2017-07-24/service-2.json). There is noResourceNotFoundExceptionshape anywhere in this service's model. TheImageDeletedandImageVersionDeletedwaiters, however, matched their success acceptor againstResourceNotFoundException-- a name that never appears in any real response from these operations.As a result, once an image (or image version) was actually deleted and
DescribeImage/DescribeImageVersionstarted returning the realResourceNotFounderror, none of the acceptors matched, so the waiter incorrectly raised aWaiterErrorinstead of treating the deletion as complete -- exactly the symptom reported in #3782 against the real API.This fixes both waiters to match on the shape name the operations actually declare and return:
ResourceNotFound.Testing
TestSagemakerWaitersintests/functional/test_sagemaker.py, usingStubberto confirm bothimage_deletedandimage_version_deletedwaiters treat aResourceNotFounderror as the success condition.developwith a small script usingStubberto inject aResourceNotFounderror: theimage_deletedwaiter raisedWaiterError(matching the reporter's#3782traceback), then confirmed it passes with this fix, and that reverting the fix while keeping the new test reproduces the failure again.ResourceNotFoundExceptiondoes not exist anywhere insagemaker'sservice-2.jsonshapes, whileResourceNotFoundis the exact shape declared forDescribeImage,DescribeImageVersion, and several otherDescribe*operations in this service (e.g.DescribeTrainingJob,DescribeProcessingJob,DescribeTransformJob), confirmingResourceNotFoundis the correct, consistent shape name to match on.