From 7ac0ef4406c9f58375f507ad536777e4b3e045e0 Mon Sep 17 00:00:00 2001 From: Gavin Date: Thu, 24 Feb 2022 01:55:07 -0700 Subject: [PATCH] Fix VM Scale Set Fetch and Commands (#134) * Fixed VMSS fetcher * Fixed VM Scale Set Run Command Signed-off-by: GavinHC --- chaosazure/common/compute/command.py | 4 ++-- chaosazure/vmss/fetcher.py | 13 +------------ 2 files changed, 3 insertions(+), 14 deletions(-) diff --git a/chaosazure/common/compute/command.py b/chaosazure/common/compute/command.py index d8c9cd8..b27efcf 100644 --- a/chaosazure/common/compute/command.py +++ b/chaosazure/common/compute/command.py @@ -45,12 +45,12 @@ def run(resource_group: str, compute: dict, timeout: int, parameters: dict, compute_type = compute.get('type').lower() if compute_type == RES_TYPE_VMSS_VM.lower(): - poller = client.virtual_machine_scale_set_vms.run_command( + poller = client.virtual_machine_scale_set_vms.begin_run_command( resource_group, compute['scale_set'], compute['instance_id'], parameters) elif compute_type == RES_TYPE_VM.lower(): - poller = client.virtual_machines.run_command( + poller = client.virtual_machines.begin_run_command( resource_group, compute['name'], parameters) else: diff --git a/chaosazure/vmss/fetcher.py b/chaosazure/vmss/fetcher.py index ce60770..cc76446 100644 --- a/chaosazure/vmss/fetcher.py +++ b/chaosazure/vmss/fetcher.py @@ -61,20 +61,9 @@ def fetch_vmss(filter, configuration, secrets) -> List[dict]: # Private helper functions ############################################################################# def __fetch_vmss_instances(choice, configuration, secrets) -> List[Dict]: - vmss_instances = [] client = init_compute_management_client(secrets, configuration) - pages = client.virtual_machine_scale_set_vms.list( + vmss_instances = client.virtual_machine_scale_set_vms.list( choice['resourceGroup'], choice['name']) - first_page = pages.advance_page() - vmss_instances.extend(list(first_page)) - - while True: - try: - page = pages.advance_page() - vmss_instances.extend(list(page)) - except StopIteration: - break - results = __parse_vmss_instances_result(vmss_instances, choice) return results