Skip to content

Commit

Permalink
Check if template key exists in api result
Browse files Browse the repository at this point in the history
  • Loading branch information
maynero committed Jul 24, 2021
1 parent d7b0139 commit 83005f4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion proxmox.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def __init__(self, data=[], pxmxver=0.0):

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]

Expand Down

0 comments on commit 83005f4

Please sign in to comment.