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:
parent
e79c7e0f41
commit
49349fce5e
2 changed files with 3 additions and 1 deletions
2
changelogs/fragments/6838-proxmox-dict-template.yml
Normal file
2
changelogs/fragments/6838-proxmox-dict-template.yml
Normal 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).
|
|
@ -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):
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue