From 89f17357b1fe08ac488298f70757923cfd55b09d Mon Sep 17 00:00:00 2001 From: Sungwoo Bae Date: Wed, 10 Aug 2022 12:01:40 -0700 Subject: [PATCH 1/3] Update list available Ips to fetch from subnet --- src/vm-repair/azext_vm_repair/custom.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/vm-repair/azext_vm_repair/custom.py b/src/vm-repair/azext_vm_repair/custom.py index 18d1ef04290..9f999c08748 100644 --- a/src/vm-repair/azext_vm_repair/custom.py +++ b/src/vm-repair/azext_vm_repair/custom.py @@ -567,16 +567,17 @@ def reset_nic(cmd, vm_name, resource_group_name, yes=False): ip_config_object = json.loads(ip_config_string) subnet_id = ip_config_object['subnet']['id'] - vnet_name = subnet_id.split('/')[-3] + subnet_id_tokens = subnet_id.split('/') + subnet_name = subnet_id_tokens[-1] + vnet_name = subnet_id_tokens[-3] ipconfig_name = ip_config_object['name'] orig_ip_address = ip_config_object['privateIpAddress'] # Dynamic | Static orig_ip_allocation_method = ip_config_object['privateIpAllocationMethod'] # Get aviailable ip address within subnet - # Change to az network vnet subnet list-available-ips when it is available - get_available_ip_command = 'az network vnet list-available-ips -g {g} -n {vnet} --query [0] -o tsv' \ - .format(g=resource_group_name, vnet=vnet_name) + get_available_ip_command = 'az network vnet subnet list-available-ips -g {g} --vnet-name {vnet} --name {subnet} --query [0] -o tsv' \ + .format(g=resource_group_name, vnet=vnet_name, subnet=subnet_name) swap_ip_address = _call_az_command(get_available_ip_command) if not swap_ip_address: # Raise available IP not found From a14d120266597d3b4a1ed86643f3e2e18dc18579 Mon Sep 17 00:00:00 2001 From: Sungwoo Bae Date: Wed, 10 Aug 2022 12:08:03 -0700 Subject: [PATCH 2/3] Version bump for vm repair --- src/vm-repair/setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vm-repair/setup.py b/src/vm-repair/setup.py index e54fc81e972..c6255f8980e 100644 --- a/src/vm-repair/setup.py +++ b/src/vm-repair/setup.py @@ -8,7 +8,7 @@ from codecs import open from setuptools import setup, find_packages -VERSION = "0.4.4" +VERSION = "0.4.5" CLASSIFIERS = [ 'Development Status :: 4 - Beta', From be1793226ccebeceacfc9a8c7da0172fb2a53474 Mon Sep 17 00:00:00 2001 From: Sungwoo Bae Date: Wed, 10 Aug 2022 12:10:47 -0700 Subject: [PATCH 3/3] Update HISTORY.rst --- src/vm-repair/HISTORY.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/vm-repair/HISTORY.rst b/src/vm-repair/HISTORY.rst index 12d4c2c8d43..8e4af56d574 100644 --- a/src/vm-repair/HISTORY.rst +++ b/src/vm-repair/HISTORY.rst @@ -2,6 +2,10 @@ Release History =============== +0.4.5 +++++++ +Improve az vm repair reset-nic command to use subnet list available ips command + 0.4.4 ++++++ Add az vm repair reset-nic command