From 3acb6c12f83c2da441bd5f0216ad1201eb952b51 Mon Sep 17 00:00:00 2001 From: Hang Lei Date: Fri, 15 Nov 2024 14:15:28 +0800 Subject: [PATCH 1/3] Init --- pylintrc | 1 - .../azure/cli/command_modules/acs/_roleassignments.py | 2 +- .../azure/cli/command_modules/appservice/_params.py | 2 +- .../azure/cli/command_modules/billing/manual/_params.py | 4 ++-- .../cli/command_modules/cdn/custom/custom_rule_util.py | 2 +- .../azure/cli/command_modules/policyinsights/_params.py | 8 ++++---- .../relay/tests/latest/test_relay_commands.py | 4 ++-- src/azure-cli/azure/cli/command_modules/search/custom.py | 8 ++++---- src/azure-cli/azure/cli/command_modules/sql/custom.py | 4 ++-- .../azure/cli/command_modules/storage/commands.py | 2 +- .../azure/cli/command_modules/synapse/manual/_params.py | 2 +- src/azure-cli/azure/cli/command_modules/vm/_params.py | 2 +- 12 files changed, 20 insertions(+), 21 deletions(-) diff --git a/pylintrc b/pylintrc index bbf7f0544f9..ca86186f413 100644 --- a/pylintrc +++ b/pylintrc @@ -52,7 +52,6 @@ disable= # These rules were added in Pylint >= 2.12, disable them to avoid making retroactive change missing-timeout, superfluous-parens, - implicit-str-concat, unnecessary-dunder-call, # These rules were added in Pylint >= 3.2 possibly-used-before-assignment, diff --git a/src/azure-cli/azure/cli/command_modules/acs/_roleassignments.py b/src/azure-cli/azure/cli/command_modules/acs/_roleassignments.py index 70f002e6bbd..224f1792f13 100644 --- a/src/azure-cli/azure/cli/command_modules/acs/_roleassignments.py +++ b/src/azure-cli/azure/cli/command_modules/acs/_roleassignments.py @@ -301,7 +301,7 @@ def ensure_cluster_identity_permission_on_kubelet_identity(cmd, cluster_identity if use_shared_identity(): return raise UnauthorizedError( - "Could not grant Managed Identity Operator " "permission to cluster identity at scope {}".format(scope) + "Could not grant Managed Identity Operator permission to cluster identity at scope {}".format(scope) ) diff --git a/src/azure-cli/azure/cli/command_modules/appservice/_params.py b/src/azure-cli/azure/cli/command_modules/appservice/_params.py index 523b78f39dc..b6e97c7f692 100644 --- a/src/azure-cli/azure/cli/command_modules/appservice/_params.py +++ b/src/azure-cli/azure/cli/command_modules/appservice/_params.py @@ -438,7 +438,7 @@ def load_arguments(self, _): c.argument('dapr_enable_api_logging', options_list=['--dapr-enable-api-logging', '--dal'], help="Enable/Disable API logging for the Dapr sidecar.", arg_type=get_three_state_flag(return_label=True)) c.argument('workload_profile_name', help="The name of the workload profile to run the app on.", is_preview=True) c.argument('cpu', type=float, help="Required CPU in cores from 0.5 to 2.0.", is_preview=True) - c.argument('memory', help="Required momory from 1.0 to 4.0 ending with ""Gi"" e.g. 1.0Gi, ", is_preview=True) + c.argument('memory', help="Required momory from 1.0 to 4.0 ending with Gi e.g. 1.0Gi, ", is_preview=True) with self.argument_context('functionapp runtime config') as c: c.argument('runtime_version', help='The version of the functions runtime stack. Use "az functionapp list-flexconsumption-runtimes" to check supported runtimes and versions', is_preview=True) diff --git a/src/azure-cli/azure/cli/command_modules/billing/manual/_params.py b/src/azure-cli/azure/cli/command_modules/billing/manual/_params.py index 4cb25668fd9..9ba4b68c95f 100644 --- a/src/azure-cli/azure/cli/command_modules/billing/manual/_params.py +++ b/src/azure-cli/azure/cli/command_modules/billing/manual/_params.py @@ -65,7 +65,7 @@ def load_arguments(self, _): "invoice_name", options_list=["--name", "-n", "--invoice-name"], type=str, - help="The ID that " "uniquely identifies an invoice.", + help="The ID that uniquely identifies an invoice.", ) c.argument( "by_subscription", @@ -129,7 +129,7 @@ def load_arguments(self, _): "name", options_list=["--name", "-n"], type=str, - help="The ID that uniquely identifies a role " "assignment.", + help="The ID that uniquely identifies a role assignment.", ) c.argument( "profile_name", diff --git a/src/azure-cli/azure/cli/command_modules/cdn/custom/custom_rule_util.py b/src/azure-cli/azure/cli/command_modules/cdn/custom/custom_rule_util.py index 5e208fb0f99..b8932d52fb9 100644 --- a/src/azure-cli/azure/cli/command_modules/cdn/custom/custom_rule_util.py +++ b/src/azure-cli/azure/cli/command_modules/cdn/custom/custom_rule_util.py @@ -292,7 +292,7 @@ def create_action(action_name, cache_behavior=None, cache_duration=None, header_ action = { "cache_key_query_string": { "parameters": { - "type_name" "DeliveryRuleCacheKeyQueryStringBehaviorActionParameters" + "type_nameDeliveryRuleCacheKeyQueryStringBehaviorActionParameters" "query_string_behavior": query_string_behavior, "query_parameters": query_parameters } diff --git a/src/azure-cli/azure/cli/command_modules/policyinsights/_params.py b/src/azure-cli/azure/cli/command_modules/policyinsights/_params.py index 864d6b0364a..ca855bb6a0e 100644 --- a/src/azure-cli/azure/cli/command_modules/policyinsights/_params.py +++ b/src/azure-cli/azure/cli/command_modules/policyinsights/_params.py @@ -42,17 +42,17 @@ def load_arguments(self, _): 'namespace', completer=get_providers_completion_list, arg_group='Resource ID', - help='Provider namespace (Ex: ''Microsoft.Provider'').') + help='Provider namespace (Ex: Microsoft.Provider).') c.argument( 'resource_type_parent', options_list=['--parent'], arg_group='Resource ID', - help='The parent path (Ex: ''resourceTypeA/nameA/resourceTypeB/nameB'').') + help='The parent path (Ex: resourceTypeA/nameA/resourceTypeB/nameB).') c.argument( 'resource_type', completer=get_resource_types_completion_list, arg_group='Resource ID', - help='Resource type (Ex: ''resourceTypeC'').') + help='Resource type (Ex: resourceTypeC).') for scope in ['state', 'event']: with self.argument_context('policy {}'.format(scope)) as c: @@ -137,7 +137,7 @@ def load_arguments(self, _): 'location_filters', options_list='--location-filters', nargs='+', - help='Space separated list of resource locations that should be remediated (Ex: ''centralus westeurope'').') # pylint: disable=line-too-long + help='Space separated list of resource locations that should be remediated (Ex: centralus westeurope).') # pylint: disable=line-too-long c.argument( 'policy_assignment', options_list=['--policy-assignment', '-a'], diff --git a/src/azure-cli/azure/cli/command_modules/relay/tests/latest/test_relay_commands.py b/src/azure-cli/azure/cli/command_modules/relay/tests/latest/test_relay_commands.py index 8e4bc42b30d..a1ea961faa2 100644 --- a/src/azure-cli/azure/cli/command_modules/relay/tests/latest/test_relay_commands.py +++ b/src/azure-cli/azure/cli/command_modules/relay/tests/latest/test_relay_commands.py @@ -102,7 +102,7 @@ def test_relay_hyco(self, resource_group): 'loc': 'westus2', 'rg': resource_group, 'namespacename': self.create_random_name(prefix='relay-nscli', length=20), - 'tags': 'tag1=value1' 'tag2=value2', + 'tags': 'tag1=value1tag2=value2', 'authoname': self.create_random_name(prefix='cliAutho', length=20), 'defaultauthorizationrule': 'RootManageSharedAccessKey', 'accessrights': 'Listen', @@ -185,7 +185,7 @@ def test_relay_wcfrelay(self, resource_group): 'rg': resource_group, 'relaytype': 'Http', 'namespacename': self.create_random_name(prefix='relay-nscli', length=20), - 'tags': 'tag1=value1' 'tag2=value2', + 'tags': 'tag1=value1tag2=value2', 'authoname': self.create_random_name(prefix='cliAutho', length=20), 'defaultauthorizationrule': 'RootManageSharedAccessKey', 'accessrights': 'Send', diff --git a/src/azure-cli/azure/cli/command_modules/search/custom.py b/src/azure-cli/azure/cli/command_modules/search/custom.py index 5197a76aeac..4b279328e55 100644 --- a/src/azure-cli/azure/cli/command_modules/search/custom.py +++ b/src/azure-cli/azure/cli/command_modules/search/custom.py @@ -48,7 +48,7 @@ def pre_operations(self): if args.hosting_mode == "highDensity" and args.sku != "standard3": raise UnrecognizedArgumentError( - "SearchService.HostingMode: ""highDensity"" is only allowed when sku is ""standard3""") + "SearchService.HostingMode: highDensity is only allowed when sku is standard3") if has_value(args.ip_rules): ip_rules = re.split(';|,', args.ip_rules.to_serialized_data()) @@ -173,7 +173,7 @@ def update_search_service(instance, partition_count=0, replica_count=0, public_n if public_network_access: if (public_network_access.lower() not in ["enabled", "disabled"]): raise UnrecognizedArgumentError( - "SearchService.PublicNetworkAccess: only [""enabled"", ""disabled""] are allowed") + "SearchService.PublicNetworkAccess: only [enabled, disabled] are allowed") instance.public_network_access = public_network_access if ip_rules: _ip_rules = [] @@ -318,12 +318,12 @@ def setup_search_auth(instance, disable_local_auth, auth_options, aad_auth_failu # Done by argument define if (auth_options is not None and auth_options not in ["aadOrApiKey", "apiKeyOnly"]): raise UnrecognizedArgumentError( - "SearchService.AuthOptions: only [""aadOrApiKey"", ""apiKeyOnly""] are allowed") + "SearchService.AuthOptions: only [aadOrApiKey, apiKeyOnly] are allowed") # Done in aaz by default if (aad_auth_failure_mode is not None and aad_auth_failure_mode not in ["http401WithBearerChallenge", "http403"]): raise UnrecognizedArgumentError( "SearchService.AuthOptions.AadAuthFailureMode: only " - "[""http401WithBearerChallenge"", ""http403""] are allowed") + "[http401WithBearerChallenge, http403] are allowed") # Done in pre_operations if disable_local_auth and auth_options: diff --git a/src/azure-cli/azure/cli/command_modules/sql/custom.py b/src/azure-cli/azure/cli/command_modules/sql/custom.py index 34a7f451ed1..681ab19c390 100644 --- a/src/azure-cli/azure/cli/command_modules/sql/custom.py +++ b/src/azure-cli/azure/cli/command_modules/sql/custom.py @@ -281,7 +281,7 @@ def _find_edition_capability(sku, supported_editions): return next(e for e in supported_editions if e.name == sku.tier) except StopIteration: candidate_editions = [e.name for e in supported_editions] - raise CLIError('Could not find tier ''{}''. Supported tiers are: {}'.format( + raise CLIError('Could not find tier {}. Supported tiers are: {}'.format( sku.tier, candidate_editions )) else: @@ -304,7 +304,7 @@ def _find_family_capability(sku, supported_families): return next(f for f in supported_families if f.name == sku.family) except StopIteration: candidate_families = [e.name for e in supported_families] - raise CLIError('Could not find family ''{}''. Supported families are: {}'.format( + raise CLIError('Could not find family {}. Supported families are: {}'.format( sku.family, candidate_families )) else: diff --git a/src/azure-cli/azure/cli/command_modules/storage/commands.py b/src/azure-cli/azure/cli/command_modules/storage/commands.py index 445f9438b3a..53d3b26cec2 100644 --- a/src/azure-cli/azure/cli/command_modules/storage/commands.py +++ b/src/azure-cli/azure/cli/command_modules/storage/commands.py @@ -392,7 +392,7 @@ def get_custom_sdk(custom_module, client_factory, resource_type=ResourceType.DAT g.storage_custom_command_oauth('generate-sas', 'generate_sas_blob_uri') blob_service_sdk = CliCommandType( - operations_tmpl='azure.multiapi.storagev2.blob._blob_service_client#' 'BlobServiceClient.{}', + operations_tmpl='azure.multiapi.storagev2.blob._blob_service_client#BlobServiceClient.{}', client_factory=cf_blob_service, resource_type=ResourceType.DATA_STORAGE_BLOB ) diff --git a/src/azure-cli/azure/cli/command_modules/synapse/manual/_params.py b/src/azure-cli/azure/cli/command_modules/synapse/manual/_params.py index 6bbd033f3f2..2441a985510 100644 --- a/src/azure-cli/azure/cli/command_modules/synapse/manual/_params.py +++ b/src/azure-cli/azure/cli/command_modules/synapse/manual/_params.py @@ -91,7 +91,7 @@ def load_arguments(self, _): c.argument('sql_admin_login_password', options_list=['--sql-admin-login-password', '-p'], help='The sql administrator login password.') c.argument('tags', arg_type=tags_type) - c.argument('allowed_aad_tenant_ids', options_list=['--allowed-tenant-ids'], nargs='+', help="The approved Azure AD tenants which outbound data traffic allowed to. The Azure AD tenant of the current user will be included by default. Use ""(\'""\' in PowerShell) to disable all allowed tenant ids.") + c.argument('allowed_aad_tenant_ids', options_list=['--allowed-tenant-ids'], nargs='+', help="The approved Azure AD tenants which outbound data traffic allowed to. The Azure AD tenant of the current user will be included by default. Use (\'\' in PowerShell) to disable all allowed tenant ids.") c.argument('key_name', help='The workspace customer-managed key display name. All existing keys can be found using "az synapse workspace key list" cmdlet.') c.argument('repository_type', arg_group=repository_arg_group, arg_type=get_enum_type(['AzureDevOpsGit', 'GitHub']), validator=validate_repository_type, help='The repository configuration type.') c.argument('host_name', arg_group=repository_arg_group, help='If using github Enterprise Server, provide sever URL. Do not use this option with GitHub Enterprise Cloud.') diff --git a/src/azure-cli/azure/cli/command_modules/vm/_params.py b/src/azure-cli/azure/cli/command_modules/vm/_params.py index a6ca5c7941a..2d13e1f40c4 100644 --- a/src/azure-cli/azure/cli/command_modules/vm/_params.py +++ b/src/azure-cli/azure/cli/command_modules/vm/_params.py @@ -1136,7 +1136,7 @@ def load_arguments(self, _): c.argument('subnet_address_prefix', help='The subnet IP address prefix to use when creating a new VNet in CIDR format.') c.argument('nics', nargs='+', help='Names or IDs of existing NICs to attach to the VM. The first NIC will be designated as primary. If omitted, a new NIC will be created. If an existing NIC is specified, do not specify subnet, VNet, public IP or NSG.') c.argument('private_ip_address', help='Static private IP address (e.g. 10.0.0.5).') - c.argument('public_ip_address', help='Name of the public IP address when creating one (default) or referencing an existing one. Can also reference an existing public IP by ID or specify "" for None (\'""\' in Azure CLI using PowerShell or --% operator). For Azure CLI using powershell core edition 7.3.4, specify '' or "" (--public-ip-address '' or --public-ip-address "")') + c.argument('public_ip_address', help='Name of the public IP address when creating one (default) or referencing an existing one. Can also reference an existing public IP by ID or specify "" for None (\'""\' in Azure CLI using PowerShell or --% operator). For Azure CLI using powershell core edition 7.3.4, specify or "" (--public-ip-address or --public-ip-address "")') c.argument('public_ip_address_allocation', help=None, default=None, arg_type=get_enum_type(['dynamic', 'static'])) c.argument('public_ip_address_dns_name', help='Globally unique DNS name for a newly created public IP.') From ff5cd94f053f995fec22cef803015697a5c92b0b Mon Sep 17 00:00:00 2001 From: Hang Date: Wed, 20 Nov 2024 15:49:32 +0800 Subject: [PATCH 2/3] Apply suggestions from code review Co-authored-by: Jiashuo Li <4003950+jiasli@users.noreply.github.com> --- .../azure/cli/command_modules/cdn/custom/custom_rule_util.py | 2 +- .../command_modules/relay/tests/latest/test_relay_commands.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/azure-cli/azure/cli/command_modules/cdn/custom/custom_rule_util.py b/src/azure-cli/azure/cli/command_modules/cdn/custom/custom_rule_util.py index b8932d52fb9..205484712bf 100644 --- a/src/azure-cli/azure/cli/command_modules/cdn/custom/custom_rule_util.py +++ b/src/azure-cli/azure/cli/command_modules/cdn/custom/custom_rule_util.py @@ -292,7 +292,7 @@ def create_action(action_name, cache_behavior=None, cache_duration=None, header_ action = { "cache_key_query_string": { "parameters": { - "type_nameDeliveryRuleCacheKeyQueryStringBehaviorActionParameters" + "type_name": "DeliveryRuleCacheKeyQueryStringBehaviorActionParameters", "query_string_behavior": query_string_behavior, "query_parameters": query_parameters } diff --git a/src/azure-cli/azure/cli/command_modules/relay/tests/latest/test_relay_commands.py b/src/azure-cli/azure/cli/command_modules/relay/tests/latest/test_relay_commands.py index a1ea961faa2..55012cccec1 100644 --- a/src/azure-cli/azure/cli/command_modules/relay/tests/latest/test_relay_commands.py +++ b/src/azure-cli/azure/cli/command_modules/relay/tests/latest/test_relay_commands.py @@ -102,7 +102,7 @@ def test_relay_hyco(self, resource_group): 'loc': 'westus2', 'rg': resource_group, 'namespacename': self.create_random_name(prefix='relay-nscli', length=20), - 'tags': 'tag1=value1tag2=value2', + 'tags': 'tag1=value1 tag2=value2', 'authoname': self.create_random_name(prefix='cliAutho', length=20), 'defaultauthorizationrule': 'RootManageSharedAccessKey', 'accessrights': 'Listen', @@ -185,7 +185,7 @@ def test_relay_wcfrelay(self, resource_group): 'rg': resource_group, 'relaytype': 'Http', 'namespacename': self.create_random_name(prefix='relay-nscli', length=20), - 'tags': 'tag1=value1tag2=value2', + 'tags': 'tag1=value1 tag2=value2', 'authoname': self.create_random_name(prefix='cliAutho', length=20), 'defaultauthorizationrule': 'RootManageSharedAccessKey', 'accessrights': 'Send', From aa903701b6e076fae63dbd01675c6e5399fc2eb5 Mon Sep 17 00:00:00 2001 From: Hang Date: Wed, 27 Nov 2024 16:39:15 +0800 Subject: [PATCH 3/3] Update src/azure-cli/azure/cli/command_modules/synapse/manual/_params.py --- .../azure/cli/command_modules/synapse/manual/_params.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/azure-cli/azure/cli/command_modules/synapse/manual/_params.py b/src/azure-cli/azure/cli/command_modules/synapse/manual/_params.py index 2441a985510..59059714203 100644 --- a/src/azure-cli/azure/cli/command_modules/synapse/manual/_params.py +++ b/src/azure-cli/azure/cli/command_modules/synapse/manual/_params.py @@ -91,7 +91,7 @@ def load_arguments(self, _): c.argument('sql_admin_login_password', options_list=['--sql-admin-login-password', '-p'], help='The sql administrator login password.') c.argument('tags', arg_type=tags_type) - c.argument('allowed_aad_tenant_ids', options_list=['--allowed-tenant-ids'], nargs='+', help="The approved Azure AD tenants which outbound data traffic allowed to. The Azure AD tenant of the current user will be included by default. Use (\'\' in PowerShell) to disable all allowed tenant ids.") + c.argument('allowed_aad_tenant_ids', options_list=['--allowed-tenant-ids'], nargs='+', help="The approved Azure AD tenants which outbound data traffic allowed to. The Azure AD tenant of the current user will be included by default. Use \"\" or '' ('\"\"' in PowerShell) to disable all allowed tenant ids.") c.argument('key_name', help='The workspace customer-managed key display name. All existing keys can be found using "az synapse workspace key list" cmdlet.') c.argument('repository_type', arg_group=repository_arg_group, arg_type=get_enum_type(['AzureDevOpsGit', 'GitHub']), validator=validate_repository_type, help='The repository configuration type.') c.argument('host_name', arg_group=repository_arg_group, help='If using github Enterprise Server, provide sever URL. Do not use this option with GitHub Enterprise Cloud.')