Skip to content

Commit

Permalink
Fix param name fix for disk override (#6998)
Browse files Browse the repository at this point in the history
  • Loading branch information
nascarsayan authored Nov 21, 2023
1 parent c326520 commit 7ebe379
Show file tree
Hide file tree
Showing 6 changed files with 774 additions and 538 deletions.
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

0 comments on commit 7ebe379

Please sign in to comment.