diff --git a/src/vm-repair/HISTORY.rst b/src/vm-repair/HISTORY.rst index d4cf98ce462..b4c41a40cea 100644 --- a/src/vm-repair/HISTORY.rst +++ b/src/vm-repair/HISTORY.rst @@ -2,6 +2,11 @@ Release History =============== +2.1.1 +++++++ +Added a breaking change warning message for Build 2025 and `--associate-public-ip` parameter. + +======= 2.1.0 ++++++ Added new parameter `--os-disk-type` to `vm repair create` to let users specify the repair vm's os disk storage account type. diff --git a/src/vm-repair/azext_vm_repair/_validators.py b/src/vm-repair/azext_vm_repair/_validators.py index d7d42c9f794..7bbd31b2c3e 100644 --- a/src/vm-repair/azext_vm_repair/_validators.py +++ b/src/vm-repair/azext_vm_repair/_validators.py @@ -235,9 +235,11 @@ def _prompt_public_ip(namespace): except NoTTYException: raise ValidationError('Please specify the associate-public-ip parameter in non-interactive mode.') + def _return_public_ip_name(namespace): return namespace.repair_vm_name + "PublicIP" + def _classic_vm_exists(cmd, resource_group_name, vm_name): classic_vm_provider = 'Microsoft.ClassicCompute' vm_resource_type = 'virtualMachines' diff --git a/src/vm-repair/azext_vm_repair/custom.py b/src/vm-repair/azext_vm_repair/custom.py index fc45a73a4bc..47d8cbbbec0 100644 --- a/src/vm-repair/azext_vm_repair/custom.py +++ b/src/vm-repair/azext_vm_repair/custom.py @@ -79,6 +79,9 @@ def create(cmd, vm_name, resource_group_name, repair_password=None, repair_usern - os_disk_type: Set the OS disk storage account type of the repair VM to the specified type. The default is PremiumSSD_LRS. """ + # A warning about a future breaking change. + logger.warning('After the Build 2025 release, the --associate-public-ip option will be changed to just be a flag parameter instead of a boolean.') + # Logging all the command parameters, except the sensitive data. # Mask sensitive information masked_repair_password = '****' if repair_password else None @@ -160,9 +163,8 @@ def create(cmd, vm_name, resource_group_name, repair_password=None, repair_usern # Adding the size to the command. create_repair_vm_command += ' --size {sku}'.format(sku=sku) - # Setting the availability zone for the repair VM. - # If the source VM has availability zones, the first one is chosen for the repair VM. + # If the source VM has availability zones, the first one is chosen for the repair VM. if source_vm.zones: zone = source_vm.zones[0] create_repair_vm_command += ' --zone {zone}'.format(zone=zone) @@ -270,7 +272,6 @@ def create(cmd, vm_name, resource_group_name, repair_password=None, repair_usern # Execute the command to attach the disk. _call_az_command(attach_disk_command) - # Check if the source VM uses unmanaged disks. # If it does, the repair VM will also be created with unmanaged disks. else: @@ -333,7 +334,6 @@ def create(cmd, vm_name, resource_group_name, repair_password=None, repair_usern .format(g=repair_group_name, disk_name=copy_disk_name, vm_name=repair_vm_name, uri=copy_disk_id) _call_az_command(attach_disk_command) - # Check if the Nested Hyper-V needs to be enabled. # If it does, run the script to install Hyper-V and create the nested VM. if enable_nested: @@ -435,6 +435,10 @@ def create(cmd, vm_name, resource_group_name, repair_password=None, repair_usern # This method is responsible for restoring the VM after repair def restore(cmd, vm_name, resource_group_name, disk_name=None, repair_vm_id=None, yes=False): + # Initialize repair VM variables to avoid "used before assignment" errors + repair_vm_name = None + repair_resource_group = None + # Create an instance of the command helper object to facilitate logging and status tracking. command = command_helper(logger, cmd, 'vm repair restore') @@ -604,8 +608,7 @@ def run(cmd, vm_name, resource_group_name, run_id=None, repair_vm_id=None, custo logger.info('Running script on %s: %s', vm_string, repair_vm_name) # Log the VM on which the script is being run - - # Start the timer to measure the run-time of the script + # Start the timer to measure the run-time of the script script_start_time = timeit.default_timer() # Invoke the run command on the VM and capture the standard output and error @@ -653,7 +656,6 @@ def run(cmd, vm_name, resource_group_name, run_id=None, repair_vm_id=None, custo # Set the overall command status to success command.set_status_success() - except KeyboardInterrupt: command.error_stack_trace = traceback.format_exc() command.error_message = "Command interrupted by user input." diff --git a/src/vm-repair/azext_vm_repair/repair_utils.py b/src/vm-repair/azext_vm_repair/repair_utils.py index e3eb0349f94..181f9ee2d5e 100644 --- a/src/vm-repair/azext_vm_repair/repair_utils.py +++ b/src/vm-repair/azext_vm_repair/repair_utils.py @@ -729,7 +729,7 @@ def _get_function_param_dict(frame): return values -def _unlock_encrypted_vm_run(repair_vm_name, repair_group_name, is_linux, encrypt_recovery_key = ""): +def _unlock_encrypted_vm_run(repair_vm_name, repair_group_name, is_linux, encrypt_recovery_key=""): stdout, stderr = _unlock_singlepass_encrypted_disk(repair_vm_name, repair_group_name, is_linux, encrypt_recovery_key) logger.debug('Unlock script STDOUT:\n%s', stdout) if stderr: diff --git a/src/vm-repair/setup.py b/src/vm-repair/setup.py index cae9802da9c..07d3391abc2 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 = "2.1.0" +VERSION = "2.1.1" CLASSIFIERS = [ 'Development Status :: 4 - Beta',