Add support for INI debug

In order to troubleshoot spice connection issues, add ini debug option
This commit is contained in:
jpattWPC 2022-03-10 16:58:24 -06:00
parent d3df0c4df6
commit fc60d99a65
4 changed files with 23 additions and 3 deletions

2
dist/vdiclient.json vendored
View File

@ -1,6 +1,6 @@
{ {
"upgrade_guid" : "46cbad92-353e-4b28-9bee-83950991dad8", "upgrade_guid" : "46cbad92-353e-4b28-9bee-83950991dad8",
"version" : "1.0.0", "version" : "1.0.1",
"product_name" : "VDI Client", "product_name" : "VDI Client",
"manufacturer" : "Josh Patten", "manufacturer" : "Josh Patten",
"name" : "VDI Client", "name" : "VDI Client",

View File

@ -2,3 +2,4 @@
pip install pyinstaller pip install pyinstaller
pip install proxmoxer pip install proxmoxer
pip install PySimpleGUIQt pip install PySimpleGUIQt
pip install requests

View File

@ -9,6 +9,8 @@ icon = vdiicon.ico
logo = vdiclient.png logo = vdiclient.png
# Enable Kiosk mode, which does not allow the user to close anything # Enable Kiosk mode, which does not allow the user to close anything
kiosk = False kiosk = False
# Enable displaying SPICE ini file before opening virt-viewer
inidebug = False
[Authentication] [Authentication]
# This is the authentication backend that will be used to authenticate # This is the authentication backend that will be used to authenticate

View File

@ -27,6 +27,7 @@ class G:
kiosk = False kiosk = False
verify_ssl = True verify_ssl = True
icon = None icon = None
inidebug = False
theme = 'LightBlue' theme = 'LightBlue'
sg.theme(G.theme) sg.theme(G.theme)
@ -78,6 +79,8 @@ def loadconfig(config_location = None):
G.imagefile = config['General']['logo'] G.imagefile = config['General']['logo']
if 'kiosk' in config['General']: if 'kiosk' in config['General']:
G.kiosk = config['General'].getboolean('kiosk') G.kiosk = config['General'].getboolean('kiosk')
if 'inidebug' in config['General']:
G.inidebug = config['General'].getboolean('inidebug')
if not 'Authentication' in config: if not 'Authentication' in config:
win_popup_button(f'Unable to read supplied configuration:\nNo `Authentication` section defined!', 'OK') win_popup_button(f'Unable to read supplied configuration:\nNo `Authentication` section defined!', 'OK')
return False return False
@ -170,6 +173,18 @@ def setvmlayout(vms):
layout.append([sg.Button('Logout', font=["Helvetica", 14])]) layout.append([sg.Button('Logout', font=["Helvetica", 14])])
return layout return layout
def iniwin(inistring):
inilayout = [
[sg.Multiline(default_text=inistring, size=(800, 600))]
]
iniwindow = sg.Window('INI debug', inilayout)
while True:
event, values = iniwindow.read()
if event == None:
break
iniwindow.close()
return True
def vmaction(vmnode, vmid, vmtype): def vmaction(vmnode, vmid, vmtype):
status = False status = False
if vmtype == 'qemu': if vmtype == 'qemu':
@ -206,7 +221,6 @@ def vmaction(vmnode, vmid, vmtype):
if startpop: if startpop:
startpop.close() startpop.close()
return status return status
connpop = win_popup(f'Connecting to {vmstatus["name"]}...')
if vmtype == 'qemu': if vmtype == 'qemu':
spiceconfig = G.proxmox.nodes(vmnode).qemu(str(vmid)).spiceproxy.post() spiceconfig = G.proxmox.nodes(vmnode).qemu(str(vmid)).spiceproxy.post()
else: # Not sure this is even a thing, but here it is... else: # Not sure this is even a thing, but here it is...
@ -226,6 +240,9 @@ def vmaction(vmnode, vmid, vmtype):
confignode.write(inifile) confignode.write(inifile)
inifile.seek(0) inifile.seek(0)
inistring = inifile.read() inistring = inifile.read()
if G.inidebug:
closed = iniwin(inistring)
connpop = win_popup(f'Connecting to {vmstatus["name"]}...')
pcmd = [G.vvcmd] pcmd = [G.vvcmd]
if G.kiosk: if G.kiosk:
pcmd.append('--kiosk') pcmd.append('--kiosk')