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

{vm-repair} Add code documentation and fix Unbound exceptions #8124

Merged
merged 20 commits into from
Nov 27, 2024
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Merge branch 'main' into adsandor/refactor
  • Loading branch information
Sandido authored Nov 19, 2024
commit a3235ff2aa29f94c353d8255f208071c4abad179
18 changes: 10 additions & 8 deletions src/vm-repair/azext_vm_repair/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,16 +142,17 @@ def create(cmd, vm_name, resource_group_name, repair_password=None, repair_usern
# Setting the OS type to 'Windows'.
os_type = 'Windows'

# Setting up the base command to create the repair VM.
if is_linux:
# If the source VM's OS is Linux, the command includes a custom data script.
# Set public IP address for repair VM
public_ip_name = _make_public_ip_name(repair_vm_name, associate_public_ip)

# Set up base create vm command
if is_linux:
create_repair_vm_command = 'az vm create -g {g} -n {n} --tag {tag} --image {image} --admin-username {username} --admin-password {password} --public-ip-address {option} --custom-data {cloud_init_script}' \
.format(g=repair_group_name, n=repair_vm_name, tag=resource_tag, image=os_image_urn, username=repair_username, password=repair_password, option=associate_public_ip, cloud_init_script=_get_cloud_init_script())
else:
# If the source VM's OS is not Linux, the command does not include a custom data script.
.format(g=repair_group_name, n=repair_vm_name, tag=resource_tag, image=os_image_urn, username=repair_username, password=repair_password, option=public_ip_name, cloud_init_script=_get_cloud_init_script())
else:
create_repair_vm_command = 'az vm create -g {g} -n {n} --tag {tag} --image {image} --admin-username {username} --admin-password {password} --public-ip-address {option}' \
.format(g=repair_group_name, n=repair_vm_name, tag=resource_tag, image=os_image_urn, username=repair_username, password=repair_password, option=associate_public_ip)
.format(g=repair_group_name, n=repair_vm_name, tag=resource_tag, image=os_image_urn, username=repair_username, password=repair_password, option=public_ip_name)

# Fetching the size of the repair VM.
sku = _fetch_compatible_sku(source_vm, enable_nested)
if not sku:
Expand Down Expand Up @@ -652,6 +653,7 @@ 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
Loading
You are viewing a condensed version of this merge commit. You can view the full changes here.