X-Git-Url: http://xvm.mit.edu/gitweb/invirt/packages/invirt-web.git/blobdiff_plain/632ab6dde450c5e7b35f8817816c9d04294bd230..4750a3526415132120713c6631007bb07700e028:/code/main.py diff --git a/code/main.py b/code/main.py index c8444e8..f13fe0c 100755 --- a/code/main.py +++ b/code/main.py @@ -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]) @@ -691,14 +696,12 @@ class App: headers.update(new_headers) e = revertStandardError() if e: - if isinstance(output, basestring): - sys.stderr = StringIO() - x = str(output) - print >> sys.stderr, x - print >> sys.stderr, 'XXX' - print >> sys.stderr, e - raise Exception() - output.addError(e) + if hasattr(output, 'addError'): + output.addError(e) + else: + # This only happens on redirects, so it'd be a pain to get + # the message to the user. Maybe in the response is useful. + output = output + '\n\nstderr:\n' + e output_string = str(output) checkpoint.checkpoint('output as a string') except Exception, err: