Open
Description
Summary
When i try to use the module proxmox_vm_info
with a specific vmid i get in some rare circumstance (not really reproducible) the following error:
Failed to retrieve QEMU VMs information: 'template'
Looking into the code the error is probably coming from https://github.com/ansible-collections/community.general/blob/stable-9/plugins/modules/proxmox_vm_info.py#L204
I'm using proxmox version 8.1.x and 8.2.x
Maybe an easy fix would just be to use desired_vm.get
instead of square brackets?
desired_vm["template"] = proxmox_to_ansible_bool(desired_vm.get("template", 0))
Issue Type
Bug Report
Component Name
proxmox_vm_info
Ansible Version
$ ansible --version
ansible [core 2.16.6]
...
python version = 3.11.2 (main, Sep 14 2024, 03:00:30) [GCC 12.2.0] (/workspaces/.venv/bin/python)
jinja version = 3.1.6
libyaml = True
Community.general Version
$ ansible-galaxy collection list community.general
Collection Version
----------------- -------
community.general 9.4.0
Configuration
$ ansible-config dump --only-changed
OS / Environment
No response
Steps to Reproduce
- name: Get vm configuration
community.general.proxmox_vm_info:
vmid: "{{ vmid }}"
config: current
register: proxmox_vm_info
Expected Results
TASK [deploy_vm : Get vm configuration] ************************
ok: [virtual_machine -> localhost] => {"changed": false, "proxmox_vms": [ ... ]}
Actual Results
TASK [proxmox_deploy_vm : Get vm configuration] ************************
fatal: [virtual_machine -> localhost]: FAILED! => {"changed": false, "msg": "Failed to retrieve QEMU VMs information: 'template'"}
Code of Conduct
- I agree to follow the Ansible Code of Conduct