From: Geoffrey Thomas Date: Mon, 28 Jul 2008 12:25:01 +0000 (-0400) Subject: sipb-xen-www: Use invirt.config to pick the VNC proxy port. X-Git-Tag: sipb-xen-www/3.6~5 X-Git-Url: http://xvm.mit.edu/gitweb/invirt/packages/invirt-web.git/commitdiff_plain/4ce0edc046482af00c58171cb63064da34561e79 sipb-xen-www: Use invirt.config to pick the VNC proxy port. svn path=/trunk/packages/sipb-xen-www/; revision=770 --- diff --git a/code/main.py b/code/main.py index f13fe0c..4627c66 100755 --- a/code/main.py +++ b/code/main.py @@ -6,12 +6,12 @@ import cPickle import cgi import datetime import hmac +import random import sha import simplejson import sys import time import urllib -import random from StringIO import StringIO def revertStandardError(): @@ -41,6 +41,8 @@ import cache_acls from webcommon import InvalidInput, CodeError, State import controls from getafsgroups import getAfsGroupMembers +import invirt.config +invirt_config = invirt.config.load() def pathSplit(path): if path.startswith('/'): @@ -255,10 +257,8 @@ def vnc(username, state, path, fields): token = {'data': pickled_data, 'digest': m.digest()} token = cPickle.dumps(token) token = base64.urlsafe_b64encode(token) - if controls.listHost(machine) == 'sx-blade-2.mit.edu': - port = 10004 - else: - port = 10003 + port = 10003 + [config_host["hostname"] for config_host in invirt_config["hosts"] + ].index(controls.listHost(machine)) status = controls.statusInfo(machine) has_vnc = hasVnc(status)