web: support sx-blade-2 for VNC applet
[invirt/packages/invirt-web.git] / code / main.py
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)
     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)
 
     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'),
              has_vnc=has_vnc,
              machine=machine,
              hostname=state.environ.get('SERVER_NAME', 'localhost'),
+             port=port,
              authtoken=token)
     return templates.vnc(searchList=[d])
 
              authtoken=token)
     return templates.vnc(searchList=[d])