Merge pull request #47 from bekema/main

Prevent exceptions when a node is offline
This commit is contained in:
joshpatten 2023-02-15 08:50:14 -06:00 committed by GitHub
commit 7bc5966cd6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -164,15 +164,22 @@ def setmainlayout():
if G.totp:
layout.append([sg.Text("OTP Key", size =(12*G.scaling, 1), font=["Helvetica", 12]), sg.InputText(key='-totp-', font=["Helvetica", 12])])
if G.kiosk:
layout.append([sg.Button("Log In", font=["Helvetica", 14])])
layout.append([sg.Button("Log In", font=["Helvetica", 14], bind_return_key=True)])
else:
layout.append([sg.Button("Log In", font=["Helvetica", 14]), sg.Button("Cancel", font=["Helvetica", 14])])
layout.append([sg.Button("Log In", font=["Helvetica", 14], bind_return_key=True), sg.Button("Cancel", font=["Helvetica", 14])])
return layout
def getvms(listonly = False):
vms = []
try:
nodes = []
for node in G.proxmox.cluster.resources.get(type='node'):
if node['status'] == 'online':
nodes.append(node['node'])
for vm in G.proxmox.cluster.resources.get(type='vm'):
if vm['node'] not in nodes:
continue
if 'template' in vm and vm['template']:
continue
if G.guest_type == 'both' or G.guest_type == vm['type']: