[Compute] Normalize storage type case in target region validation - #33882
Open
Hashim Khan (Hashim1999164) wants to merge 1 commit into
Open
[Compute] Normalize storage type case in target region validation#33882Hashim Khan (Hashim1999164) wants to merge 1 commit into
Hashim Khan (Hashim1999164) wants to merge 1 commit into
Conversation
Compare three-part --target-regions storage account types with .lower(), matching the two-part form. Apply the same check to four-part --target-edge-zones validation. Fixes Azure#33880.
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
microsoft-github-policy-service
Bot
requested review from
Julie Zhu (yanzhudd) and
Yong Zhang (yonzhan)
August 12, 2026 23:40
Copilot started reviewing on behalf of
Hashim Khan (Hashim1999164)
August 12, 2026 23:40
View session
Contributor
|
Thank you for your contribution Hashim Khan (@Hashim1999164)! We will review the pull request and get back to you soon. |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes inconsistent case handling for storage account type validation in az sig image-version create parsing logic, making mixed-case values behave consistently across supported --target-regions/--target-edge-zones syntaxes.
Changes:
- Make three-part
--target-regionsparsing validate storage account types case-insensitively (matching the existing two-part behavior). - Apply the same case-insensitive validation to four-part
--target-edge-zonesparsing. - Add a unit test covering mixed-case
--target-regionsvalues (two-part and three-part).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_vm_actions.py |
Adds test coverage for mixed-case storage types in --target-regions parsing. |
src/azure-cli/azure/cli/command_modules/vm/_validators.py |
Updates validators to check storage_account_type.lower() for three-part target regions and four-part target edge zones. |
Suppressed comments (1)
src/azure-cli/azure/cli/command_modules/vm/_validators.py:2506
- Typo in error message: "forth" should be "fourth".
if storage_account_type.lower() not in storage_account_types_list:
raise ArgumentUsageError(
"usage error: {} is an invalid target edge zone argument. "
"The forth part is not a valid storage account type. "
"Storage account types must be one of {}.".format(t, storage_account_types_str))
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+586
to
+597
| # three-part region=replica=storage_type must accept mixed-case storage types | ||
| # the same way the two-part region=storage_type form does | ||
| target_regions_list = ["southeastasia=1=Standard_LRS", "westus2=Premium_LRS"] | ||
| np.target_regions = target_regions_list | ||
| process_gallery_image_version_namespace(cmd, np) | ||
| target_regions_objs = np.target_regions | ||
| self.assertEqual(target_regions_objs[0]["name"], "southeastasia") | ||
| self.assertEqual(target_regions_objs[0]["regional_replica_count"], 1) | ||
| self.assertEqual(target_regions_objs[0]["storage_account_type"], "Standard_LRS") | ||
| self.assertEqual(target_regions_objs[1]["name"], "westus2") | ||
| self.assertEqual(target_regions_objs[1]["storage_account_type"], "Premium_LRS") | ||
|
|
Collaborator
|
Compute |
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.
Summary
az sig image-version create --target-regionsvalidated storage account types case-insensitively for the two-part form (region=Standard_LRS) but case-sensitively for the three-part form (region=1=Standard_LRS).This compares with
.lower()in the three-part path, matching the two-part path, and applies the same fix to the four-part--target-edge-zonesvalidator. A unit test covers mixed-case three-part and two-part values.Fixes #33880
Test plan
python -m unittest azure.cli.command_modules.vm.tests.latest.test_vm_actions.TestVMImage.test_process_gallery_image_version_namespace(or the local test module equivalent)southeastasia=1=Standard_LRSno longer fails local validation