1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

proxmox: default value when checking for dict key (#6838)

* proxmox: default value when checking for dict key

* add changelog frag
This commit is contained in:
Alexei Znamensky 2023-07-08 08:24:32 +12:00 committed by GitHub
parent e79c7e0f41
commit 49349fce5e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 1 deletions

View file

@ -0,0 +1,2 @@
bugfixes:
- proxmox - fix error when a configuration had no ``template`` field (https://github.com/ansible-collections/community.general/pull/6838, https://github.com/ansible-collections/community.general/issues/5372).

View file

@ -448,7 +448,7 @@ class ProxmoxLxcAnsible(ProxmoxAnsible):
"""Check if the specified container is a template.""" """Check if the specified container is a template."""
proxmox_node = self.proxmox_api.nodes(node) proxmox_node = self.proxmox_api.nodes(node)
config = getattr(proxmox_node, VZ_TYPE)(vmid).config.get() config = getattr(proxmox_node, VZ_TYPE)(vmid).config.get()
return config['template'] return config.get('template', False)
def create_instance(self, vmid, node, disk, storage, cpus, memory, swap, timeout, clone, **kwargs): def create_instance(self, vmid, node, disk, storage, cpus, memory, swap, timeout, clone, **kwargs):