[Compute] Normalize storage type case in target region validation - #33882
[Compute] Normalize storage type case in target region validation#33882Hashim Khan (Hashim1999164) wants to merge 2 commits 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. |
|
Thank you for your contribution Hashim Khan (@Hashim1999164)! We will review the pull request and get back to you soon. |
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.
|
Compute |
Add a unit test for region=edgeZone=replica=storageType and correct the fourth part wording in the validator error.
|
Pushed a follow up for the review notes. Added a unit test in |
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