From 172e8bb161f7bca278973ad5bb523a6e97e49788 Mon Sep 17 00:00:00 2001 From: "patchback[bot]" <45432694+patchback[bot]@users.noreply.github.com> Date: Sat, 24 Jul 2021 20:58:17 +0200 Subject: [PATCH] proxmox inventory plugin: Easy fix (#3052) (#3059) * Don't know why this works but it does. Plugin was crashing on this line on Python 3.9.2 deployed on qemu image with debian bullseye. It doesn't crash anymore. * Create 3052_proxmox_inventory_plugin.yml * Update changelogs/fragments/3052_proxmox_inventory_plugin.yml Co-authored-by: Ajpantuso Co-authored-by: Ajpantuso (cherry picked from commit 99c28313e4fdfb4665cbaf2c6d35396c7fa1394d) Co-authored-by: The Right Honourable Reverend --- changelogs/fragments/3052_proxmox_inventory_plugin.yml | 2 ++ plugins/inventory/proxmox.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/3052_proxmox_inventory_plugin.yml diff --git a/changelogs/fragments/3052_proxmox_inventory_plugin.yml b/changelogs/fragments/3052_proxmox_inventory_plugin.yml new file mode 100644 index 0000000000..dfd4dddea9 --- /dev/null +++ b/changelogs/fragments/3052_proxmox_inventory_plugin.yml @@ -0,0 +1,2 @@ +bugfixes: + - proxmox inventory plugin - fixed plugin failure when a ``qemu`` guest has no ``template`` key (https://github.com/ansible-collections/community.general/pull/3052). diff --git a/plugins/inventory/proxmox.py b/plugins/inventory/proxmox.py index f0f5a4e418..33a564f333 100644 --- a/plugins/inventory/proxmox.py +++ b/plugins/inventory/proxmox.py @@ -413,7 +413,7 @@ class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable): node_qemu_group = self.to_safe('%s%s' % (self.get_option('group_prefix'), ('%s_qemu' % node['node']).lower())) self.inventory.add_group(node_qemu_group) for qemu in self._get_qemu_per_node(node['node']): - if qemu['template']: + if qemu.get('template'): continue self.inventory.add_host(qemu['name'])