{Core} Work around long-running delete or purge operation with 404 status code#17833
Conversation
Comment on lines
988
to
996
| except (ClientException, HttpResponseError) as client_exception: | ||
| from azure.cli.core.commands.arm import handle_long_running_operation_exception | ||
| self.progress_bar.stop() | ||
| if getattr(client_exception, 'status_code', None) == 404 and 'delete' in self.cli_ctx.data['command']: | ||
| logger.debug('Service returned 404 on the long-running delete operation. CLI treats it as delete ' | ||
| 'successfully but service should fix this behavior.') | ||
| if getattr(client_exception, 'status_code', None) == 404 and \ | ||
| ('delete' in self.cli_ctx.data['command'] or 'purge' in self.cli_ctx.data['command']): | ||
| logger.debug('Service returned 404 on the long-running delete or purge operation. CLI treats it as ' | ||
| 'delete or purge successfully but service should fix this behavior.') | ||
| return None | ||
| handle_long_running_operation_exception(client_exception) |
Member
There was a problem hiding this comment.
Please double check whether handle_long_running_operation_exception can handle track 2 HttpResponseError as well.
Contributor
Author
There was a problem hiding this comment.
Yes, it could.
Before this change, the HttpResponseError is raised to an outer exception handler.
After this change, it just wraps the exception and throw a CLIError, which i think doesn't have risks here.
Contributor
Author
There was a problem hiding this comment.
We may add anthor except block to keep the exactly same behavior, but i think it's not really necessary.
3 tasks
Contributor
Author
|
Test cases will fail if we wrap the error in advance rather than raise it. So i just update the codes to keep the original behavior. |
fengzhou-msft
approved these changes
Apr 23, 2021
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.
Description
This PR works around the Track2 case of the long-running delete or purge operation with 404 status code when polling completes.
Track1 works around it in this PR #15884
Testing Guide
History Notes
[Component Name 1] BREAKING CHANGE: az command a: Make some customer-facing breaking change.
[Component Name 2] az command b: Add some customer-facing feature.
This checklist is used to make sure that common guidelines for a pull request are followed.
The PR title and description has followed the guideline in Submitting Pull Requests.
I adhere to the Command Guidelines.
I adhere to the Error Handling Guidelines.