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

Fix param name fix for disk override #6998

Merged
merged 5 commits into from
Nov 21, 2023
Merged
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
6 changes: 6 additions & 0 deletions src/connectedvmware/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

Release History
===============
0.2.3
++++++
* Fix docs and help for vm creation from template with disk override.
* Convert any HCRP machine with empty kind to VMWare / AVS kind, while enabling vm from inventory.
* Reprompt fix for password for vcenter connect.

0.2.2
++++++
* GA release: Using stable API version for all operations.
Expand Down
4 changes: 2 additions & 2 deletions src/connectedvmware/azext_connectedvmware/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,8 @@ def load_arguments(self, _):
action=VmDiskAddAction,
nargs='+',
help="Disk overrides for the vm. "
"Usage: --disk name=<> disk_size=<> disk_mode=<> controller_key=<> "
"device-key=<> unit_number=<>.",
"Usage: --disk name=<> disk-size=<> disk-mode=<> controller-key=<> "
"device-key=<> unit-number=<>.",
)

with self.argument_context('connectedvmware vm update') as c:
Expand Down
15 changes: 10 additions & 5 deletions src/connectedvmware/azext_connectedvmware/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ def connect_vcenter(
creds['password'] = pwinput('Please provide vcenter password: ')
if not creds['password']:
print('Parameter is required, please try again')
continue
passwdConfim = pwinput('Please confirm vcenter password: ')
if creds['password'] != passwdConfim:
print('Passwords do not match, please try again')
Expand Down Expand Up @@ -981,19 +982,23 @@ def create_vm(
machine = None
try:
machine = machine_client.get(resource_group_name, resource_name)
machine_kind = None
if f"{machine.kind}".lower() != f"{vcenter.kind}".lower():
raise InvalidArgumentValueError(
"The existing Machine resource is not of the same kind as the vCenter. " +
f"Machine kind: '{machine.kind}', vCenter kind: '{vcenter.kind}'"
)
if machine.kind:
raise InvalidArgumentValueError(
"The existing Machine resource is not of the same kind as the vCenter. " +
f"Machine kind: '{machine.kind}', vCenter kind: '{vcenter.kind}'"
)
machine_kind = vcenter.kind
if location is not None and machine.location != location:
raise InvalidArgumentValueError(
"The location of the existing Machine cannot be updated. " +
"Either specify the existing location or keep the location unspecified. " +
f"Existing location: {machine.location}, Provided location: {location}"
)
if tags is not None:
if any(x is not None for x in [machine_kind, tags]):
m = MachineUpdate(
kind=machine_kind,
tags=tags,
)
machine = machine_client.update(resource_group_name, resource_name, m)
Expand Down
Loading