From 83005f4ab69f49752d78e12fc5fc1a66e122e028 Mon Sep 17 00:00:00 2001 From: maynero Date: Sat, 24 Jul 2021 08:41:46 +0800 Subject: [PATCH] Check if template key exists in api result --- proxmox.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proxmox.py b/proxmox.py index 46f893e..4f9140d 100755 --- a/proxmox.py +++ b/proxmox.py @@ -65,7 +65,7 @@ class ProxmoxVMList(list): def get_names(self): if self.ver >= 4.0: - return [vm['name'] for vm in self if vm['template'] != 1] + return [vm['name'] for vm in self if 'template' in vm and vm['template'] != 1] else: return [vm['name'] for vm in self]