Skip to content

Commit 2cce8a3

Browse files
committed
fix
1 parent 6dcfdbe commit 2cce8a3

File tree

4 files changed

+14
-5
lines changed

4 files changed

+14
-5
lines changed

src/azure-cli/azure/cli/command_modules/acs/agentpool_decorator.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2056,7 +2056,10 @@ def set_up_vm_properties(self, agentpool: AgentPool) -> AgentPool:
20562056
"""
20572057
self._ensure_agentpool(agentpool)
20582058

2059-
agentpool.type = self.context.get_vm_set_type()
2059+
if self.agentpool_decorator_mode == AgentPoolDecoratorMode.MANAGED_CLUSTER:
2060+
agentpool.type = self.context.get_vm_set_type()
2061+
else:
2062+
agentpool.type_properties_type = self.context.get_vm_set_type()
20602063

20612064
agentpool.proximity_placement_group_id = self.context.get_ppg()
20622065
agentpool.enable_encryption_at_host = self.context.get_enable_encryption_at_host()

src/azure-cli/azure/cli/command_modules/acs/managed_cluster_decorator.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -433,9 +433,9 @@ def __validate_cluster_autoscaler_profile(
433433
)
434434
)
435435
# verify keys
436-
# pylint: disable=protected-access
436+
from azure.core.serialization import attribute_list
437437
valid_keys = list(
438-
k.replace("_", "-") for k in self.models.ManagedClusterPropertiesAutoScalerProfile()._attr_to_rest_field.keys()
438+
k.replace("_", "-") for k in attribute_list(self.models.ManagedClusterPropertiesAutoScalerProfile())
439439
)
440440
for key in cluster_autoscaler_profile.keys():
441441
if not key:

src/azure-cli/azure/cli/command_modules/acs/tests/latest/test_agentpool_decorator.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2549,7 +2549,7 @@ def common_set_up_vm_properties(self):
25492549
if self.agentpool_decorator_mode == AgentPoolDecoratorMode.MANAGED_CLUSTER:
25502550
ground_truth_agentpool_1.type = CONST_VIRTUAL_MACHINE_SCALE_SETS
25512551
else:
2552-
ground_truth_agentpool_1.type = CONST_VIRTUAL_MACHINE_SCALE_SETS
2552+
ground_truth_agentpool_1.type_properties_type = CONST_VIRTUAL_MACHINE_SCALE_SETS
25532553
self.assertEqual(dec_agentpool_1, ground_truth_agentpool_1)
25542554

25552555
def common_set_up_custom_node_config(self):
@@ -2862,7 +2862,6 @@ def test_construct_agentpool_profile_default(self):
28622862
count=3,
28632863
node_taints=[],
28642864
upgrade_settings=ground_truth_upgrade_settings_1,
2865-
type=CONST_VIRTUAL_MACHINE_SCALE_SETS,
28662865
enable_encryption_at_host=False,
28672866
enable_ultra_ssd=False,
28682867
enable_fips=False,
@@ -2872,6 +2871,10 @@ def test_construct_agentpool_profile_default(self):
28722871
host_group_id=None,
28732872
capacity_reservation_group_id=None,
28742873
)
2874+
if self.agentpool_decorator_mode == AgentPoolDecoratorMode.MANAGED_CLUSTER:
2875+
ground_truth_agentpool_1.type = CONST_VIRTUAL_MACHINE_SCALE_SETS
2876+
else:
2877+
ground_truth_agentpool_1.type_properties_type = CONST_VIRTUAL_MACHINE_SCALE_SETS
28752878
self.assertEqual(dec_agentpool_1, ground_truth_agentpool_1)
28762879

28772880
dec_1.context.raw_param.print_usage_statistics()

src/azure-cli/azure/cli/command_modules/acs/tests/latest/test_aks_commands.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14098,6 +14098,7 @@ def test_vms_agentpool_type(self, resource_group, resource_group_location):
1409814098
"--node-count 1",
1409914099
checks=[
1410014100
self.check("provisioningState", "Succeeded"),
14101+
self.check("typePropertiesType", "VirtualMachines"),
1410114102
self.check("vmSize", ""),
1410214103
self.check("count", None),
1410314104
self.check("virtualMachinesProfile.scale.manual[0].size", "Standard_D2s_v3", False),
@@ -14126,6 +14127,7 @@ def test_vms_agentpool_type(self, resource_group, resource_group_location):
1412614127
"--node-count 1",
1412714128
checks=[
1412814129
self.check("provisioningState", "Succeeded"),
14130+
self.check("typePropertiesType", "VirtualMachines"),
1412914131
self.check("vmSize", ""),
1413014132
self.check("count", None),
1413114133
self.check("virtualMachinesProfile.scale.manual[1].size", "Standard_DS2_v2", False),
@@ -14143,6 +14145,7 @@ def test_vms_agentpool_type(self, resource_group, resource_group_location):
1414314145
"--node-count 3",
1414414146
checks=[
1414514147
self.check("provisioningState", "Succeeded"),
14148+
self.check("typePropertiesType", "VirtualMachines"),
1414614149
self.check("vmSize", ""),
1414714150
self.check("count", None),
1414814151
self.check("virtualMachinesProfile.scale.manual[1].size", "Standard_D8s_v3", False),

0 commit comments

Comments
 (0)