-
Notifications
You must be signed in to change notification settings - Fork 3.3k
{Compute} az vmss scale: Migrate command to aaz-based implementation
#32795
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -4493,19 +4493,20 @@ def restart_vmss(cmd, resource_group_name, vm_scale_set_name, instance_ids=None, | |||||
|
|
||||||
| # pylint: disable=inconsistent-return-statements | ||||||
| def scale_vmss(cmd, resource_group_name, vm_scale_set_name, new_capacity, no_wait=False): | ||||||
| VirtualMachineScaleSet = cmd.get_models('VirtualMachineScaleSet') | ||||||
| client = _compute_client_factory(cmd.cli_ctx) | ||||||
| vmss = client.virtual_machine_scale_sets.get(resource_group_name, vm_scale_set_name) | ||||||
| # pylint: disable=no-member | ||||||
| if vmss.sku.capacity == new_capacity: | ||||||
| from .operations.vmss import VMSSCreate, VMSSShow, convert_show_result_to_snake_case | ||||||
| vmss = VMSSShow(cli_ctx=cmd.cli_ctx)(command_args={ | ||||||
| 'resource_group': resource_group_name, | ||||||
| 'vm_scale_set_name': vm_scale_set_name | ||||||
| }) | ||||||
| vmss = convert_show_result_to_snake_case(vmss) | ||||||
|
|
||||||
| if vmss.get('sku', {}).get('capacity') == new_capacity: | ||||||
| return | ||||||
|
|
||||||
| vmss.sku.capacity = new_capacity | ||||||
| vmss_new = VirtualMachineScaleSet(location=vmss.location, sku=vmss.sku) | ||||||
| if vmss.extended_location is not None: | ||||||
| vmss_new.extended_location = vmss.extended_location | ||||||
| return sdk_no_wait(no_wait, client.virtual_machine_scale_sets.begin_create_or_update, | ||||||
| resource_group_name, vm_scale_set_name, vmss_new) | ||||||
| vmss['sku']['capacity'] = new_capacity | ||||||
| vmss['no_wait'] = no_wait | ||||||
|
|
||||||
| VMSSCreate(cli_ctx=cmd.cli_ctx)(command_args=vmss) | ||||||
|
||||||
| VMSSCreate(cli_ctx=cmd.cli_ctx)(command_args=vmss) | |
| return VMSSCreate(cli_ctx=cmd.cli_ctx)(command_args=vmss) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
VMSSCreaterequiresresource_groupandvm_scale_set_namearguments (see aaz latest vmss Create args schema). The dict produced byconvert_show_result_to_snake_case(vmss)doesn’t include these keys, so this call will fail with missing required arguments. Please addresource_group=resource_group_nameandvm_scale_set_name=vm_scale_set_nameto thecommand_argspassed toVMSSCreate(either by setting them onvmssor by constructing a new args dict).