Skip to content
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

Breaking change message for associate-public-ip #8535

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/vm-repair/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 2 additions & 0 deletions src/vm-repair/azext_vm_repair/_validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
16 changes: 9 additions & 7 deletions src/vm-repair/azext_vm_repair/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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')

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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."
Expand Down
2 changes: 1 addition & 1 deletion src/vm-repair/azext_vm_repair/repair_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
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 = "2.1.0"
VERSION = "2.1.1"

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