-
Notifications
You must be signed in to change notification settings - Fork 3.3k
[RDBMS] Bugfix: az postgres flexible-server create Remove hardcoded API version from network client. #15392
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…e to exclude servername and update default region for MySQL (Azure#15295) * hotfix chnages * Remove - from password if thats the first character * Style check fix and Mysql sku * Remove MySQL SKU validator * Remove MySQL SKu and tier validators
|
RDBMS |
| def network_client_factory(cli_ctx): | ||
| from azure.mgmt.network import NetworkManagementClient | ||
| return get_mgmt_service_client(cli_ctx, NetworkManagementClient, api_version="2018-08-01") | ||
| return get_mgmt_service_client(cli_ctx, ResourceType.MGMT_NETWORK) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actually you even don't need to define it here. network module already has the definition and you could just import it.
azure-cli/src/azure-cli/azure/cli/command_modules/network/_client_factory.py
Lines 7 to 10 in 0a90d44
| def network_client_factory(cli_ctx, **kwargs): | |
| from azure.cli.core.profiles import ResourceType | |
| from azure.cli.core.commands.client_factory import get_mgmt_service_client | |
| return get_mgmt_service_client(cli_ctx, ResourceType.MGMT_NETWORK, **kwargs) |
| help='The name of the compute SKU. Follows the convention Standard_{VM name}. Examples: Standard_B1ms, Standard_D4s_v3 ') | ||
| c.argument('storage_mb', default='10', options_list=['--storage-size'], type=int, validator=mysql_storage_validator, | ||
| help='The name of the compute SKU. Follows the convention Standard_{VM name}. Examples: Standard_B1ms, Standard_E16ds_v4 ') | ||
| c.argument('storage_mb', default='10', options_list=['--storage-size'], type=int, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| c.argument('storage_mb', default='10', options_list=['--storage-size'], type=int, | |
| c.argument('storage_mb', default=10, options_list=['--storage-size'], type=int, |
because it is int type.
| c.argument('backup_retention', default=7, type=int, options_list=['--backup-retention'], | ||
| help='The number of days a backup is retained. Range of 7 to 35 days. Default is 7 days.', | ||
| validator=retention_validator) | ||
| c.argument('version', default='12', options_list=['--version'], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
quick question: how can user know which kind of version is accepted?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
quick question: how can user know which kind of version is accepted?
Do you mean how they can find out which are the valid versions ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If they pass in a wrong value, they will get a Validation error with the set of acceptable values.
| if command_group == 'mysql': | ||
| c.argument('tier', options_list=['--tier'], | ||
| help='Compute tier of the server. Accepted values: Burstable, GeneralPurpose, Memory Optimized ') | ||
| help='Compute tier of the server. Accepted values: Burstable, GeneralPurpose, Memory Optimized') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
still prefer getting allowed value from SDK
| help='Compute tier of the server. Accepted values: Burstable, GeneralPurpose, Memory Optimized') | ||
| c.argument('sku_name', options_list=['--sku-name'], | ||
| help='The name of the compute SKU. Follows the convention Standard_{VM name}. Examples: Standard_B1ms, Standard_D4s_v3 ') | ||
| help='The name of the compute SKU. Follows the convention Standard_{VM name}. Examples: Standard_B1ms, Standard_E16ds_v4 ') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The same
| c.argument('storage_mb', options_list=['--storage-size'], type=int, | ||
| validator=mysql_storage_validator, | ||
| help='The storage capacity of the server. Minimum is 5 GiB and increases in 1 GiB increments. Max is 16 TiB.') | ||
| c.argument('backup_retention', type=int, options_list=['--backup-retention'], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here is to define the retention days but how could I enable/disable delete retention?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It cannot be disabled. By default it is 7 days. But user can pass a value and override the default value.
| c.argument('tier', options_list=['--tier'], | ||
| help='Compute tier of the server. Accepted values: Burstable, GeneralPurpose, Memory Optimized') | ||
| c.argument('sku_name', options_list=['--sku-name'], | ||
| help='The name of the compute SKU. Follows the convention Standard_{VM name}. Examples: Standard_D4s_v3 ') | ||
| c.argument('storage_mb', options_list=['--storage-size'], type=int, | ||
| validator=pg_storage_validator, | ||
| help='The storage capacity of the server. Minimum is 32 GiB and max is 16 TiB.') | ||
| c.argument('backup_retention', type=int, options_list=['--backup-retention'], | ||
| help='The number of days a backup is retained. Range of 7 to 35 days. Default is 7 days.', validator=retention_validator) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you have so many duplicate arguments. could you use CLIArgumentType to abstract them and reuse these type.
| c.ignore('location') | ||
| c.ignore('sku_name') | ||
| c.ignore('tier') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The three arguments are totally removed in existing command?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are not using these three args for the command currently
Juliehzl
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The 'az postgres flexible-server create' command fails with an error as reported in the issue. It happens only when CLI is installed through the installer.
This PR just removes that hardcoded API version.
https://github.com/MicrosoftDocs/azure-docs/issues/63318