@@ -5082,16 +5082,15 @@ def _output(self, *args, **kwargs):
50825082
50835083
50845084# region VirtualMachineScaleSets Diagnostics
5085- def set_vmss_diagnostics_extension (
5086- cmd , resource_group_name , vmss_name , settings , protected_settings = None , version = None ,
5087- no_auto_upgrade = False ):
5088- client = _compute_client_factory (cmd .cli_ctx )
5089- vmss = client .virtual_machine_scale_sets .get (resource_group_name , vmss_name )
5085+ def set_vmss_diagnostics_extension (cmd , resource_group_name , vmss_name , settings , protected_settings = None ,
5086+ version = None , no_auto_upgrade = False ):
5087+ from ._vm_utils import UpgradeMode
5088+ vmss = get_vmss_by_aaz (cmd , resource_group_name , vmss_name )
50905089 # pylint: disable=no-member
5091- is_linux_os = _is_linux_os (vmss . virtual_machine_profile )
5090+ is_linux_os = _is_linux_os_aaz (vmss [ 'virtualMachineProfile' ] )
50925091 vm_extension_name = _LINUX_DIAG_EXT if is_linux_os else _WINDOWS_DIAG_EXT
5093- if is_linux_os and vmss .virtual_machine_profile . extension_profile : # check incompatibles
5094- exts = vmss .virtual_machine_profile . extension_profile . extensions or []
5092+ if is_linux_os and vmss .get ( 'virtualMachineProfile' , {}). get ( 'extensionProfile' ) : # check incompatibles
5093+ exts = vmss .get ( 'virtualMachineProfile' , {}). get ( 'extensionProfile' , {}). get ( ' extensions' , [])
50955094 major_ver = extension_mappings [_LINUX_DIAG_EXT ]['version' ].split ('.' , maxsplit = 1 )[0 ]
50965095 # For VMSS, we don't do auto-removal like VM because there is no reliable API to wait for
50975096 # the removal done before we can install the newer one
@@ -5111,8 +5110,7 @@ def set_vmss_diagnostics_extension(
51115110 no_auto_upgrade )
51125111
51135112 result = LongRunningOperation (cmd .cli_ctx )(poller )
5114- UpgradeMode = cmd .get_models ('UpgradeMode' )
5115- if vmss .upgrade_policy .mode == UpgradeMode .manual :
5113+ if vmss .get ('upgradePolicy' , {}).get ('mode' ) == UpgradeMode .MANUAL .value :
51165114 poller2 = update_vmss_instances (cmd , resource_group_name , vmss_name , ['*' ])
51175115 LongRunningOperation (cmd .cli_ctx )(poller2 )
51185116 return result
0 commit comments