Skip to content

Commit 8c2dee5

Browse files
mattboentoroMatthew Boentoro
and
Matthew Boentoro
authored
{RDBMS} az postgres flexible-server create/update: change the error message for SKU name validator (#30900)
* {RDBMS} az postgres flexible-server create/update: change the error message for SKU name validator * {RDBMS} az postgres flexible-server create/update: change the error message for SKU name validator --------- Co-authored-by: Matthew Boentoro <mboentoro@microsoft.com>
1 parent 95ef126 commit 8c2dee5

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/azure-cli/azure/cli/command_modules/rdbms/validators.py

+7-3
Original file line numberDiff line numberDiff line change
@@ -472,14 +472,18 @@ def compare_sku_names(sku_1, sku_2):
472472

473473

474474
def _pg_sku_name_validator(sku_name, sku_info, tier, instance):
475+
additional_error = ''
475476
if instance is not None:
476477
tier = instance.sku.tier if tier is None else tier
478+
else:
479+
additional_error = 'When --tier is not specified, it defaults to GeneralPurpose. '
477480
if sku_name:
478481
skus = [item.lower() for item in get_postgres_skus(sku_info, tier.lower())]
479482
if sku_name.lower() not in skus:
480-
raise CLIError('Incorrect value for --sku-name. The SKU name does not match {} tier. '
481-
'Specify --tier if you did not. Or CLI will set GeneralPurpose as the default tier. '
482-
'Allowed values : {}'.format(tier, sorted(skus, key=cmp_to_key(compare_sku_names))))
483+
raise CLIError('Incorrect value for --sku-name. The SKU name does not exist in {} tier. {}'
484+
'Provide a valid SKU name for this tier, or specify --tier with the right tier for the '
485+
'SKU name chosen. Allowed values : {}'
486+
.format(tier, additional_error, sorted(skus, key=cmp_to_key(compare_sku_names))))
483487

484488

485489
def _pg_storage_performance_tier_validator(performance_tier, sku_info, tier=None, storage_size=None):

0 commit comments

Comments
 (0)