Skip to content

Commit

Permalink
Fix for vmadm get_vm_uuid out of range (#5628)
Browse files Browse the repository at this point in the history
* Fix for vmadm get_vm_uuid out of range  

* Fix for vmadm get_vm_uuid out of range

* Update changelogs/fragments/5628-fix-vmadm-off-by-one.yml

Co-authored-by: Felix Fontein <felix@fontein.de>

Co-authored-by: Felix Fontein <felix@fontein.de>
  • Loading branch information
cneira and felixfontein authored Nov 30, 2022
1 parent f7fa54e commit b8545d1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions changelogs/fragments/5628-fix-vmadm-off-by-one.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bugfixes:
- vmadm - fix for index out of range error in ``get_vm_uuid`` (https://github.com/ansible-collections/community.general/pull/5628).
2 changes: 1 addition & 1 deletion plugins/modules/vmadm.py
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ def get_vm_prop(module, uuid, prop):
def get_vm_uuid(module, alias):
# Lookup the uuid that goes with the given alias.
# Returns the uuid or '' if not found.
cmd = [module.vmadm, 'lookup', '-j', '-o', 'uuid', 'alias={1}'.format(alias)]
cmd = [module.vmadm, 'lookup', '-j', '-o', 'uuid', 'alias={0}'.format(alias)]

(rc, stdout, stderr) = module.run_command(cmd)

Expand Down

0 comments on commit b8545d1

Please sign in to comment.