Batch commands no longer throw error upon precondition failures.#5702
Merged
Batch commands no longer throw error upon precondition failures.#5702
Conversation
|
View a preview at https://prompt.ws/r/Azure/azure-cli/5702 |
cdc49a0 to
5d5fe1e
Compare
troydai
suggested changes
Mar 7, 2018
|
|
||
|
|
||
| def check_precondition_success(func): | ||
| def new_func(*args, **kwargs): |
| def new_func(*args, **kwargs): | ||
| from azure.common import AzureHttpError | ||
| try: | ||
| return (True, func(*args, **kwargs)) |
Contributor
There was a problem hiding this comment.
return 1, 2 # => (1,2)
return 1 => 1
| except AzureHttpError as ex: | ||
| # Precondition failed error | ||
| if ex.status_code != 412: | ||
| raise ex |
Contributor
There was a problem hiding this comment.
Also, can we log a warning here?
| # Precondition failed error | ||
| if ex.status_code != 412: | ||
| raise ex | ||
| return (False, None) |
troydai
suggested changes
Mar 7, 2018
| except AzureHttpError as ex: | ||
| # Precondition failed error | ||
| if ex.status_code != 412: | ||
| raise ex |
Contributor
There was a problem hiding this comment.
Also, can we log a warning here?
Contributor
|
Looks good besides the comments. |
Contributor
Author
|
@troydai could you review my feedback changes? |
troydai
approved these changes
Mar 8, 2018
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.
Closes: #5286
-batch commands should not fail upon preconditions set by user
This checklist is used to make sure that common guidelines for a pull request are followed.
General Guidelines