[BACKUP] Fix #14976: KeyError fixed and help text improved - #15718
Merged
Feng Zhou (fengzhou-msft) merged 3 commits intoNov 2, 2020
Merged
Feng Zhou (fengzhou-msft) merged 3 commits into
Feng Zhou (fengzhou-msft) merged 3 commits into
Conversation
Akshay Neema (akshayneema)
requested a review
from Feng Zhou (fengzhou-msft)
as a code owner
October 29, 2020 12:53
|
Thank you for your contribution akshayneema! We will review the pull request and get back to you soon. |
Member
|
hi Feng Zhou (@fengzhou-msft) could you help to review? |
|
|
||
| protectable_item_type_map = {'SQLDatabase': 'SQLDataBase', | ||
| 'HANADataBase': 'SAPHanaDatabase', | ||
| 'SAPHanaDatabase': 'SAPHanaDatabase', |
Contributor
There was a problem hiding this comment.
This looks like a breaking change. If someone has used HANADataBase as protectable item type in their script, it will start failing. Better to keep the older one and add another entry to the map
| return AzureVmWorkloadSQLDatabaseProtectedItem() | ||
|
|
||
|
|
||
| def _check_map(key, key_value_map): |
Contributor
There was a problem hiding this comment.
Use better naming conventions.
| if item_type_map.get(item_type) is not None: | ||
| return item_type_map[item_type] | ||
| error_text = item_type + " is an invalid argument. " + str(list(item_type_map.keys())) + " are the allowed values." | ||
| raise CLIError(error_text) |
There was a problem hiding this comment.
Please use InvalidArgumentValueError for better error classification. Houk (@houk-ms) for awareness.
Feng Zhou (fengzhou-msft)
approved these changes
Nov 2, 2020
Houk (houk-ms)
approved these changes
Nov 2, 2020
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
Added checks wherever KeyError was happening and raised customized error messages according to the situation. Did some improvements in the help text for a clearer understanding of the user.
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.