web: support sx-blade-2 for VNC applet
authorGreg Price <price@mit.edu>
Tue, 8 Jul 2008 02:40:33 +0000 (22:40 -0400)
committerGreg Price <price@mit.edu>
Tue, 8 Jul 2008 02:40:33 +0000 (22:40 -0400)
Currently hardcodes host->port mapping.
Put in database?

svn path=/trunk/packages/sipb-xen-www/; revision=667

code/main.py
code/templates/vnc.tmpl

index c8444e8..24254c7 100755 (executable)
@@ -255,6 +255,10 @@ 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
 
     status = controls.statusInfo(machine)
     has_vnc = hasVnc(status)
@@ -264,6 +268,7 @@ def vnc(username, state, path, fields):
              has_vnc=has_vnc,
              machine=machine,
              hostname=state.environ.get('SERVER_NAME', 'localhost'),
+             port=port,
              authtoken=token)
     return templates.vnc(searchList=[d])
 
index e3fbcca..c61b4f6 100644 (file)
@@ -16,7 +16,7 @@ Console to $machine.name
 <APPLET CODE="VncViewer.class" ARCHIVE="https://$hostname:446/static/VncViewer.jar"
         WIDTH="100%" HEIGHT="1000">
 <PARAM NAME="PASSWORD" VALUE="moocow">
-<PARAM NAME="PORT" VALUE="10003">
+<PARAM NAME="PORT" VALUE="$port">
 <PARAM NAME="HOST" VALUE="$hostname">
 <PARAM NAME="VMNAME" VALUE="$machine.name">
 <PARAM NAME="AUTHTOKEN" VALUE="$authtoken">