8080 CONST_VIRTUAL_MACHINES ,
8181)
8282from azure .cli .command_modules .acs ._polling import RunCommandLocationPolling
83- from azure .cli .command_modules .acs ._helpers import get_snapshot_by_snapshot_id , check_is_private_link_cluster
83+ from azure .cli .command_modules .acs ._helpers import get_snapshot_by_snapshot_id , check_is_private_link_cluster , build_etag_kwargs
8484from azure .cli .command_modules .acs ._resourcegroup import get_rg_location
8585from azure .cli .command_modules .acs .managednamespace import aks_managed_namespace_add , aks_managed_namespace_update
8686from azure .cli .command_modules .acs ._validators import extract_comma_separated_string
@@ -1357,7 +1357,7 @@ def aks_upgrade(cmd,
13571357 if active_cloud .profile != "latest" :
13581358 return sdk_no_wait (no_wait , client .begin_create_or_update , resource_group_name , name , instance )
13591359
1360- return sdk_no_wait (no_wait , client .begin_create_or_update , resource_group_name , name , instance , if_match = if_match , if_none_match = if_none_match )
1360+ return sdk_no_wait (no_wait , client .begin_create_or_update , resource_group_name , name , instance , ** build_etag_kwargs ( if_match , if_none_match ) )
13611361
13621362
13631363def _update_upgrade_settings (cmd , instance ,
@@ -1453,6 +1453,11 @@ def aks_scale(cmd, client, resource_group_name, name, node_count, nodepool_name=
14531453 raise CLIError ('The nodepool "{}" was not found.' .format (nodepool_name ))
14541454
14551455
1456+ def aks_delete (cmd , client , resource_group_name , name , no_wait = False , if_match = None , if_none_match = None ):
1457+ return sdk_no_wait (no_wait , client .begin_delete , resource_group_name , name ,
1458+ ** build_etag_kwargs (if_match , if_none_match ))
1459+
1460+
14561461def aks_show (cmd , client , resource_group_name , name ):
14571462 mc = client .get (resource_group_name , name )
14581463 return _remove_nulls ([mc ])[0 ]
@@ -1490,15 +1495,16 @@ def _remove_nulls(managed_clusters):
14901495 for managed_cluster in managed_clusters :
14911496 for attr in attrs :
14921497 if getattr (managed_cluster , attr , None ) is None :
1493- delattr ( managed_cluster , attr )
1498+ managed_cluster . pop ( attr , None )
14941499 if managed_cluster .agent_pool_profiles is not None :
14951500 for ap_profile in managed_cluster .agent_pool_profiles :
14961501 for attr in ap_attrs :
14971502 if getattr (ap_profile , attr , None ) is None :
1498- delattr (ap_profile , attr )
1499- for attr in sp_attrs :
1500- if getattr (managed_cluster .service_principal_profile , attr , None ) is None :
1501- delattr (managed_cluster .service_principal_profile , attr )
1503+ ap_profile .pop (attr , None )
1504+ if managed_cluster .service_principal_profile is not None :
1505+ for attr in sp_attrs :
1506+ if getattr (managed_cluster .service_principal_profile , attr , None ) is None :
1507+ managed_cluster .service_principal_profile .pop (attr , None )
15021508 return managed_clusters
15031509
15041510
@@ -1835,14 +1841,14 @@ def aks_get_credentials(cmd, client, resource_group_name, name, admin=False,
18351841 if admin :
18361842 if cmd .cli_ctx .cloud .profile == "latest" :
18371843 credentialResults = client .list_cluster_admin_credentials (
1838- resource_group_name , name , serverType )
1844+ resource_group_name , name , server_fqdn = serverType )
18391845 else :
18401846 credentialResults = client .list_cluster_admin_credentials (
18411847 resource_group_name , name )
18421848 else :
18431849 if cmd .cli_ctx .cloud .profile == "latest" :
18441850 credentialResults = client .list_cluster_user_credentials (
1845- resource_group_name , name , serverType , credential_format )
1851+ resource_group_name , name , server_fqdn = serverType , format = credential_format )
18461852 else :
18471853 credentialResults = client .list_cluster_user_credentials (
18481854 resource_group_name , name )
@@ -3124,8 +3130,7 @@ def aks_agentpool_upgrade(cmd, client, resource_group_name, cluster_name,
31243130 nodepool_name ,
31253131 instance ,
31263132 headers = aks_custom_headers ,
3127- if_match = if_match ,
3128- if_none_match = if_none_match ,
3133+ ** build_etag_kwargs (if_match , if_none_match ),
31293134 )
31303135
31313136
@@ -3140,7 +3145,7 @@ def aks_agentpool_scale(cmd, client, resource_group_name, cluster_name,
31403145 if new_node_count == instance .count :
31413146 raise CLIError (
31423147 "The new node count is the same as the current node count." )
3143- if instance .type_properties_type == CONST_VIRTUAL_MACHINES :
3148+ if instance .properties . type_properties_type == CONST_VIRTUAL_MACHINES :
31443149 if len (instance .virtual_machines_profile .scale .manual ) == 1 :
31453150 instance .virtual_machines_profile .scale .manual [0 ].count = new_node_count
31463151 else :
@@ -3222,7 +3227,7 @@ def aks_agentpool_delete(cmd, client, resource_group_name, cluster_name,
32223227 if cmd .cli_ctx .cloud .profile != "latest" :
32233228 return sdk_no_wait (no_wait , client .begin_delete , resource_group_name , cluster_name , nodepool_name )
32243229
3225- return sdk_no_wait (no_wait , client .begin_delete , resource_group_name , cluster_name , nodepool_name , if_match = if_match , ignore_pod_disruption_budget = ignore_pdb )
3230+ return sdk_no_wait (no_wait , client .begin_delete , resource_group_name , cluster_name , nodepool_name , ** build_etag_kwargs ( if_match ) , ignore_pod_disruption_budget = ignore_pdb )
32263231
32273232
32283233def aks_agentpool_operation_abort (cmd ,
@@ -3324,7 +3329,7 @@ def aks_agentpool_manual_scale_add(cmd,
33243329 node_count ,
33253330 no_wait = False ):
33263331 instance = client .get (resource_group_name , cluster_name , nodepool_name )
3327- if instance .type_properties_type != CONST_VIRTUAL_MACHINES :
3332+ if instance .properties . type_properties_type != CONST_VIRTUAL_MACHINES :
33283333 raise ClientRequestError ("Cannot add manual to a non-virtualmachines node pool." )
33293334
33303335 ManualScaleProfile = cmd .get_models (
@@ -3361,7 +3366,7 @@ def aks_agentpool_manual_scale_update(cmd, # pylint: disable=unused-argument
33613366 raise RequiredArgumentMissingError ("specify --vm-sizes or --node-count or both." )
33623367
33633368 instance = client .get (resource_group_name , cluster_name , nodepool_name )
3364- if instance .type_properties_type != CONST_VIRTUAL_MACHINES :
3369+ if instance .properties . type_properties_type != CONST_VIRTUAL_MACHINES :
33653370 raise ClientRequestError ("Cannot update manual in a non-virtualmachines node pool." )
33663371
33673372 _current_vm_sizes = [x .strip ().lower () for x in current_vm_sizes .split ("," )]
@@ -3402,7 +3407,7 @@ def aks_agentpool_manual_scale_delete(cmd, # pylint: disable=unused-argument
34023407 current_vm_sizes ,
34033408 no_wait = False ):
34043409 instance = client .get (resource_group_name , cluster_name , nodepool_name )
3405- if instance .type_properties_type != CONST_VIRTUAL_MACHINES :
3410+ if instance .properties . type_properties_type != CONST_VIRTUAL_MACHINES :
34063411 raise CLIError ("Cannot delete manual in a non-virtualmachines node pool." )
34073412
34083413 _current_vm_sizes = [x .strip ().lower () for x in current_vm_sizes .split ("," )]
0 commit comments