-
Notifications
You must be signed in to change notification settings - Fork 3.3k
{Core} Fix 404 in long running delete operation #15884
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
Conversation
|
Core |
|
Is |
| except ClientException as client_exception: | ||
| from azure.cli.core.commands.arm import handle_long_running_operation_exception | ||
| self.cli_ctx.get_progress_controller().stop() | ||
| if getattr(client_exception, 'status_code', None) == 404 and 'delete' in self.cli_ctx.data['command']: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even if we add this hack, Python SDK and its users will still suffers from this non-standard behavior.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have an open issue in https://github.com/Azure/azure-rest-api-specs to track this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I opened an issue in our repo #15906 for service team to deal with.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Based on a disucssion with swagger reviewers, there are some existing services using 404 in LRO. For new swaggers, there should be validation tasks to catch it but for existing ones as long as the json is not modified with PRs, it will not be caught.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still think we should force service team to fix it, instead of patching it from our side, otherwise Python SDK and its users will still suffers from this non-standard behavior.
The error is thrown during long running operation, so I think it's called on the operation status. |
|
I think we should have this logic supported in CLI core to handle these cases. Maybe also add some log info to expose these cases. Of course, at the same time, we should report these bad behiviors to service team. |
houk-ms
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Description
In the response of
DELETElong running operation, some service (observed in some corner case of servicebus, update: confirmed in swagger review session that more services have this behavior) may return 404 whileGETting operation results when the resource is successfully deleted (normally it should return 200 with no response body).To handle the 404 case, this PR adds similar logic to the error handling in
wait --deletedcommand:azure-cli/src/azure-cli-core/azure/cli/core/commands/arm.py
Lines 700 to 702 in 05e3b63
Testing Guide
Without this PR,
azdev test test_sb_alias --livewill fail when deleting the secondary namespace.With this PR, it can succeed.
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.