From b8545d10e6dc0655995fe354b285871ce1f263b2 Mon Sep 17 00:00:00 2001 From: Carlos Neira Date: Wed, 30 Nov 2022 18:41:35 -0300 Subject: [PATCH] Fix for vmadm get_vm_uuid out of range (#5628) * 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 Co-authored-by: Felix Fontein --- changelogs/fragments/5628-fix-vmadm-off-by-one.yml | 2 ++ plugins/modules/vmadm.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/5628-fix-vmadm-off-by-one.yml diff --git a/changelogs/fragments/5628-fix-vmadm-off-by-one.yml b/changelogs/fragments/5628-fix-vmadm-off-by-one.yml new file mode 100644 index 0000000000..bcb7bf63e6 --- /dev/null +++ b/changelogs/fragments/5628-fix-vmadm-off-by-one.yml @@ -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). diff --git a/plugins/modules/vmadm.py b/plugins/modules/vmadm.py index 6b4490ca57..d6110726f4 100644 --- a/plugins/modules/vmadm.py +++ b/plugins/modules/vmadm.py @@ -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)