From c0f53d60c48b7775bb1c0ed700c2b4845e62deda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dav=C3=AD=C3=B0=20Steinn=20Geirsson?= Date: Mon, 7 Mar 2022 06:45:19 +0000 Subject: [PATCH] proxmox: Fix error on VM clone (#4278) (#4306) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * proxmox: Fix error on VM clone (#4278) Incorrect parameters for `get_vmid()` and `get_vm()` caused failures when cloning VMs. Fixes #4278 * Update changelogs/fragments/4306-proxmox-fix-error-on-vm-clone.yml Co-authored-by: Felix Fontein Co-authored-by: Davíð Steinn Geirsson Co-authored-by: Felix Fontein --- changelogs/fragments/4306-proxmox-fix-error-on-vm-clone.yml | 2 ++ plugins/modules/cloud/misc/proxmox_kvm.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/4306-proxmox-fix-error-on-vm-clone.yml diff --git a/changelogs/fragments/4306-proxmox-fix-error-on-vm-clone.yml b/changelogs/fragments/4306-proxmox-fix-error-on-vm-clone.yml new file mode 100644 index 0000000000..6bba165e50 --- /dev/null +++ b/changelogs/fragments/4306-proxmox-fix-error-on-vm-clone.yml @@ -0,0 +1,2 @@ +bugfixes: + - "proxmox_kvm - fix error in check when creating or cloning (https://github.com/ansible-collections/community.general/pull/4306)." diff --git a/plugins/modules/cloud/misc/proxmox_kvm.py b/plugins/modules/cloud/misc/proxmox_kvm.py index 67dd422e97..6bfb9e2e19 100644 --- a/plugins/modules/cloud/misc/proxmox_kvm.py +++ b/plugins/modules/cloud/misc/proxmox_kvm.py @@ -1210,7 +1210,7 @@ def main(): module.exit_json(changed=False, vmid=existing_vmid, msg="VM with name <%s> already exists" % name) # Ensure the choosen VM id doesn't already exist when cloning - if proxmox.get_vm(newid, ignore_errors=True): + if proxmox.get_vm(newid, ignore_missing=True): module.exit_json(changed=False, vmid=vmid, msg="vmid %s with VM name %s already exists" % (newid, name)) if delete is not None: