From c2f6576fbe00980d4da9c260c36778729a284d9d Mon Sep 17 00:00:00 2001 From: pguermo Date: Tue, 13 Aug 2019 19:22:17 +0200 Subject: [PATCH] proxmox_kvm: While a VM is beeing created, vm has no name item (#58196) * While a VM is beeing created, vm as no name attribute * Add changelogs fragment (cherry picked from commit 8923d1353765e85ad4660f8fcc81ee4915a94f91) --- .../58194-vm-name-item-not-yet-present-at-creation-time.yaml | 2 ++ lib/ansible/modules/cloud/misc/proxmox_kvm.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/58194-vm-name-item-not-yet-present-at-creation-time.yaml diff --git a/changelogs/fragments/58194-vm-name-item-not-yet-present-at-creation-time.yaml b/changelogs/fragments/58194-vm-name-item-not-yet-present-at-creation-time.yaml new file mode 100644 index 00000000000..50c70f2144f --- /dev/null +++ b/changelogs/fragments/58194-vm-name-item-not-yet-present-at-creation-time.yaml @@ -0,0 +1,2 @@ +bugfixes: + - proxmox_kvm - fixed issue when vm has not yet a name item (https://github.com/ansible/ansible/issues/58194) diff --git a/lib/ansible/modules/cloud/misc/proxmox_kvm.py b/lib/ansible/modules/cloud/misc/proxmox_kvm.py index 260516babcf..f3d8c9dc8cf 100644 --- a/lib/ansible/modules/cloud/misc/proxmox_kvm.py +++ b/lib/ansible/modules/cloud/misc/proxmox_kvm.py @@ -604,7 +604,7 @@ def get_nextvmid(module, proxmox): def get_vmid(proxmox, name): - return [vm['vmid'] for vm in proxmox.cluster.resources.get(type='vm') if vm['name'] == name] + return [vm['vmid'] for vm in proxmox.cluster.resources.get(type='vm') if vm.get('name') == name] def get_vm(proxmox, vmid):