Check if template key exists in api result

This commit is contained in:
maynero 2021-07-24 08:41:46 +08:00
parent d7b01396b5
commit 83005f4ab6
1 changed files with 1 additions and 1 deletions

View File

@ -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]