From 1fbf5d8eb4ee3fa2feeab937b6570c3e6ae03d2a Mon Sep 17 00:00:00 2001 From: florianfischer91 <72799603+florianfischer91@users.noreply.github.com> Date: Mon, 24 Mar 2025 05:45:56 +0100 Subject: [PATCH] proxmox_vm_info: don't expect key 'template' exists in dictionary (#9910) * don't expect key 'template' exists * add changelog fragment * Update changelogs/fragments/9875-proxmox-dont-expect-key-template-to-exist.yml Co-authored-by: Felix Fontein --------- Co-authored-by: Felix Fontein --- .../9875-proxmox-dont-expect-key-template-to-exist.yml | 2 ++ plugins/modules/proxmox_vm_info.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/9875-proxmox-dont-expect-key-template-to-exist.yml diff --git a/changelogs/fragments/9875-proxmox-dont-expect-key-template-to-exist.yml b/changelogs/fragments/9875-proxmox-dont-expect-key-template-to-exist.yml new file mode 100644 index 0000000000..ff926e9cb3 --- /dev/null +++ b/changelogs/fragments/9875-proxmox-dont-expect-key-template-to-exist.yml @@ -0,0 +1,2 @@ +bugfixes: + - proxmox_vm_info - the module no longer expects that the key ``template`` exists in a dictionary returned by Proxmox (https://github.com/ansible-collections/community.general/issues/9875, https://github.com/ansible-collections/community.general/pull/9910). diff --git a/plugins/modules/proxmox_vm_info.py b/plugins/modules/proxmox_vm_info.py index 36ddea9db8..34d701c25e 100644 --- a/plugins/modules/proxmox_vm_info.py +++ b/plugins/modules/proxmox_vm_info.py @@ -200,7 +200,7 @@ class ProxmoxVmInfoAnsible(ProxmoxAnsible): if desired_vm: desired_vm.update(detected_vm) desired_vm["vmid"] = this_vm_id - desired_vm["template"] = proxmox_to_ansible_bool(desired_vm["template"]) + desired_vm["template"] = proxmox_to_ansible_bool(desired_vm.get("template", 0)) # When user wants to retrieve the VM configuration if config != "none": # pending = 0, current = 1