From d451a23080ee049682d51409b4bf93c9a30a1a71 Mon Sep 17 00:00:00 2001 From: Geoffrey Thomas Date: Wed, 30 Jul 2008 22:16:51 -0400 Subject: [PATCH] VNC: Catch the error when the VM is off and there is no host svn path=/trunk/packages/sipb-xen-www/; revision=797 --- code/main.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/code/main.py b/code/main.py index 4627c66..7af4ecc 100755 --- a/code/main.py +++ b/code/main.py @@ -257,8 +257,12 @@ def vnc(username, state, path, fields): token = {'data': pickled_data, 'digest': m.digest()} token = cPickle.dumps(token) token = base64.urlsafe_b64encode(token) - port = 10003 + [config_host["hostname"] for config_host in invirt_config["hosts"] - ].index(controls.listHost(machine)) + host = controls.listHost(machine) + if host: + port = 10003 + [config_host["hostname"] for config_host in invirt_config["hosts"] + ].index(controls.listHost(machine)) + else: + port = 5900 # dummy status = controls.statusInfo(machine) has_vnc = hasVnc(status) -- 1.7.9.5