From 55d82606b9d9c53c8f33fe0761a002a9b08e24ff Mon Sep 17 00:00:00 2001 From: Bhuvaneswari Santharam Date: Tue, 1 Jun 2021 23:48:27 -0700 Subject: [PATCH] Adding managed_clusters operation group to aks run command --- .../azure/cli/command_modules/acs/custom.py | 5 ++++- .../acs/tests/latest/test_loadbalancer.py | 2 +- .../acs/tests/latest/test_validators.py | 12 ++++++------ 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/azure-cli/azure/cli/command_modules/acs/custom.py b/src/azure-cli/azure/cli/command_modules/acs/custom.py index fdba51f7a79..588d4a95160 100644 --- a/src/azure-cli/azure/cli/command_modules/acs/custom.py +++ b/src/azure-cli/azure/cli/command_modules/acs/custom.py @@ -2259,6 +2259,7 @@ def aks_create(cmd, client, resource_group_name, name, ssh_key_value, # pylint: raise CLIError("Please use standard load balancer for private cluster") if api_server_authorized_ip_ranges or enable_private_cluster: api_server_access_profile = _populate_api_server_access_profile( + cmd, api_server_authorized_ip_ranges, enable_private_cluster=enable_private_cluster ) @@ -2761,6 +2762,7 @@ def aks_update(cmd, client, resource_group_name, name, if api_server_authorized_ip_ranges is not None: instance.api_server_access_profile = \ _populate_api_server_access_profile( + cmd, api_server_authorized_ip_ranges, instance=instance) if enable_aad: @@ -2967,7 +2969,8 @@ def aks_runcommand(cmd, client, resource_group_name, name, command_string="", co if not command_string: raise ValidationError('Command cannot be empty.') - RunCommandRequest = cmd.get_models('RunCommandRequest', resource_type=ResourceType.MGMT_CONTAINERSERVICE) + RunCommandRequest = cmd.get_models('RunCommandRequest', resource_type=ResourceType.MGMT_CONTAINERSERVICE, + operation_group='managed_clusters') request_payload = RunCommandRequest(command=command_string) request_payload.context = _get_command_context(command_files) diff --git a/src/azure-cli/azure/cli/command_modules/acs/tests/latest/test_loadbalancer.py b/src/azure-cli/azure/cli/command_modules/acs/tests/latest/test_loadbalancer.py index 74dce670ee6..2f600c2f04c 100644 --- a/src/azure-cli/azure/cli/command_modules/acs/tests/latest/test_loadbalancer.py +++ b/src/azure-cli/azure/cli/command_modules/acs/tests/latest/test_loadbalancer.py @@ -9,7 +9,7 @@ class TestLoadBalancer(unittest.TestCase): - def test_configure_load_balancer_profile(self): + def test_configure_load_balancer_profile(cmd, self): managed_outbound_ip_count = 5 outbound_ips = None outbound_ip_prefixes = None diff --git a/src/azure-cli/azure/cli/command_modules/acs/tests/latest/test_validators.py b/src/azure-cli/azure/cli/command_modules/acs/tests/latest/test_validators.py index 04fc29cbb32..dc91d32e9ad 100644 --- a/src/azure-cli/azure/cli/command_modules/acs/tests/latest/test_validators.py +++ b/src/azure-cli/azure/cli/command_modules/acs/tests/latest/test_validators.py @@ -62,7 +62,7 @@ def test_IPv6(self): class TestClusterAutoscalerParamsValidators(unittest.TestCase): - def test_empty_key_empty_value(self): + def test_empty_key_empty_value(cmd, self): cluster_autoscaler_profile = ["="] namespace = Namespace(cluster_autoscaler_profile=cluster_autoscaler_profile) err = "Empty key specified for cluster-autoscaler-profile" @@ -71,13 +71,13 @@ def test_empty_key_empty_value(self): validators.validate_cluster_autoscaler_profile(cmd, namespace) self.assertEqual(str(cm.exception), err) - def test_non_empty_key_empty_value(self): + def test_non_empty_key_empty_value(cmd, self): cluster_autoscaler_profile = ["scan-interval="] namespace = Namespace(cluster_autoscaler_profile=cluster_autoscaler_profile) validators.validate_cluster_autoscaler_profile(cmd, namespace) - def test_two_empty_keys_empty_value(self): + def test_two_empty_keys_empty_value(cmd, self): cluster_autoscaler_profile = ["=", "="] namespace = Namespace(cluster_autoscaler_profile=cluster_autoscaler_profile) err = "Empty key specified for cluster-autoscaler-profile" @@ -86,7 +86,7 @@ def test_two_empty_keys_empty_value(self): validators.validate_cluster_autoscaler_profile(cmd, namespace) self.assertEqual(str(cm.exception), err) - def test_one_empty_key_in_pair_one_non_empty(self): + def test_one_empty_key_in_pair_one_non_empty(cmd, self): cluster_autoscaler_profile = ["scan-interval=20s", "="] namespace = Namespace(cluster_autoscaler_profile=cluster_autoscaler_profile) err = "Empty key specified for cluster-autoscaler-profile" @@ -95,7 +95,7 @@ def test_one_empty_key_in_pair_one_non_empty(self): validators.validate_cluster_autoscaler_profile(cmd, namespace) self.assertEqual(str(cm.exception), err) - def test_invalid_key(self): + def test_invalid_key(cmd, self): cluster_autoscaler_profile = ["bad-key=val"] namespace = Namespace(cluster_autoscaler_profile=cluster_autoscaler_profile) err = "'bad-key' is an invalid key for cluster-autoscaler-profile" @@ -104,7 +104,7 @@ def test_invalid_key(self): validators.validate_cluster_autoscaler_profile(cmd, namespace) self.assertIn(err, str(cm.exception),) - def test_valid_parameters(self): + def test_valid_parameters(cmd, self): cluster_autoscaler_profile = ["scan-interval=20s", "scale-down-delay-after-add=15m"] namespace = Namespace(cluster_autoscaler_profile=cluster_autoscaler_profile)