From b382d69126f968fd57019e85839a926c5e3d4746 Mon Sep 17 00:00:00 2001 From: jpattWPC Date: Fri, 10 Mar 2023 09:22:10 -0600 Subject: [PATCH] Fix #51 --- dist/vdiclient.json | 2 +- vdiclient.py | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/dist/vdiclient.json b/dist/vdiclient.json index 55326bc..ec150cf 100644 --- a/dist/vdiclient.json +++ b/dist/vdiclient.json @@ -1,6 +1,6 @@ { "upgrade_guid" : "46cbad92-353e-4b28-9bee-83950991dad8", - "version" : "1.1.02", + "version" : "1.1.03", "product_name" : "VDI Client", "manufacturer" : "Josh Patten", "name" : "VDI Client", diff --git a/vdiclient.py b/vdiclient.py index b461339..a336298 100644 --- a/vdiclient.py +++ b/vdiclient.py @@ -271,10 +271,14 @@ def vmaction(vmnode, vmid, vmtype): if startpop: startpop.close() return status - if vmtype == 'qemu': - spiceconfig = G.proxmox.nodes(vmnode).qemu(str(vmid)).spiceproxy.post() - else: # Not sure this is even a thing, but here it is... - spiceconfig = G.proxmox.nodes(vmnode).lxc(str(vmid)).spiceproxy.post() + try: + if vmtype == 'qemu': + spiceconfig = G.proxmox.nodes(vmnode).qemu(str(vmid)).spiceproxy.post() + else: # Not sure this is even a thing, but here it is... + spiceconfig = G.proxmox.nodes(vmnode).lxc(str(vmid)).spiceproxy.post() + except proxmoxer.core.ResourceException as e: + win_popup_button(f"Unable to connect to VM {vmid}:\n{e!r}\nIs SPICE display configured for your VM?", 'OK') + return False confignode = ConfigParser() confignode['virt-viewer'] = {} for key, value in spiceconfig.items():