Skip to content

Commit

Permalink
Add CLI wait 1.0.6 (#7528)
Browse files Browse the repository at this point in the history
  • Loading branch information
qwuae1 authored Jul 9, 2024
1 parent 4702438 commit 6a4cd12
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 4 deletions.
5 changes: 5 additions & 0 deletions src/vm-repair/HISTORY.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@

Release History
===============
1.0.6
++++++
Add CLI update wait for ASG to wait for the operation done as the async 2rd operation will cancel the 1st call.


1.0.5
++++++
Bug fix ASG is not added properly when reset the nic
Expand Down
14 changes: 11 additions & 3 deletions src/vm-repair/azext_vm_repair/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -618,9 +618,11 @@ def reset_nic(cmd, vm_name, resource_group_name, yes=False):
for item in ip_config_object[applicationSecurityGroups]:
application_id_tokens = item['id'].split('/')
if application_id_tokens[-1] is not None:

application_names+=application_id_tokens[-1]+ " "
logger.info('applicationSecurityGroups {application_names}...\n')


logger.info('applicationSecurityGroups {application_names}...\n')


# Dynamic | Static
orig_ip_allocation_method = ip_config_object['privateIPAllocationMethod']
Expand All @@ -644,7 +646,13 @@ def reset_nic(cmd, vm_name, resource_group_name, yes=False):
update_ip_command = 'az network nic ip-config update -g {g} --nic-name {nic} -n {config} --private-ip-address {ip}' \
.format(g=resource_group_name, nic=primary_nic_name, config=ipconfig_name, ip=swap_ip_address)
_call_az_command(update_ip_command)

# Wait for IP updated
wait_ip_update_command = 'az network nic ip-config wait --updated -g {g} --nic-name {nic} -n ' \
.format(g=resource_group_name, nic=primary_nic_name)
_call_az_command(wait_ip_update_command)


# 4) Change things back. This will also invoke and wait for a VM restart.
logger.info('NIC reset is complete. Now reverting back to your original configuration...\n')
# If user had dynamic config, change back to dynamic
Expand Down Expand Up @@ -785,4 +793,4 @@ def repair_and_restore(cmd, vm_name, resource_group_name, repair_password=None,

logger.info('\n%s\n', command.message)

return return_dict
return return_dict
Original file line number Diff line number Diff line change
Expand Up @@ -782,6 +782,7 @@ def test_vmrepair_LinuxManagedCreateRestore(self, resource_group):
source_vm = vms[0]
assert source_vm['storageProfile']['osDisk']['name'] == result['copied_disk_name']

@pytest.mark.ResetNic
class ResetNICWithASG(LiveScenarioTest):

@ResourceGroupPreparer(location='westus2')
Expand Down
2 changes: 1 addition & 1 deletion src/vm-repair/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from codecs import open
from setuptools import setup, find_packages

VERSION = "1.0.5"
VERSION = "1.0.6"

CLASSIFIERS = [
'Development Status :: 4 - Beta',
Expand Down

0 comments on commit 6a4cd12

Please sign in to comment.