Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/azure-cli/azure/cli/command_modules/vm/_validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -2366,7 +2366,7 @@ def process_gallery_image_version_namespace(cmd, namespace):
try:
replica_count = int(parts[1]) # raises ValueError if this is not a replica count, try other order.
storage_account_type = parts[2]
if storage_account_type not in storage_account_types_list:
if storage_account_type.lower() not in storage_account_types_list:
raise ArgumentUsageError(
"usage error: {} is an invalid target region argument. "
"The third part is not a valid storage account type. "
Expand Down Expand Up @@ -2499,7 +2499,7 @@ def process_gallery_image_version_namespace(cmd, namespace):
try:
replica_count = int(parts[2]) # raises ValueError if this is not a replica count, try other order.
storage_account_type = parts[3]
if storage_account_type not in storage_account_types_list:
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. "
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -583,6 +583,18 @@ def test_process_gallery_image_version_namespace(self):
self.assertEqual(target_regions_objs[3]["regional_replica_count"], 2)
self.assertEqual(target_regions_objs[3]["storage_account_type"], "standard_lrs")

# 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")

Comment on lines +586 to +597
# handle invalid storage account / replica count
with self.assertRaises(CLIError):
target_regions_list = ["westus=f"]
Expand Down