mirror of
https://github.com/ComputerScienceHouse/proxstar.git
synced 2025-02-12 21:11:53 +00:00
ignore already set up ssh tunnels, use correct params for novnc
This commit is contained in:
parent
8e48bb1c95
commit
545ca65930
2 changed files with 7 additions and 3 deletions
|
@ -194,12 +194,16 @@ def vm_console(vmid):
|
||||||
rtp = 'rtp' in session['userinfo']['groups']
|
rtp = 'rtp' in session['userinfo']['groups']
|
||||||
proxmox = connect_proxmox()
|
proxmox = connect_proxmox()
|
||||||
if rtp or int(vmid) in get_user_allowed_vms(proxmox, db, user):
|
if rtp or int(vmid) in get_user_allowed_vms(proxmox, db, user):
|
||||||
start_vm_vnc(proxmox, vmid)
|
|
||||||
port = str(5900 + int(vmid))
|
port = str(5900 + int(vmid))
|
||||||
token = add_vnc_target(port)
|
token = add_vnc_target(port)
|
||||||
node = "{}.csh.rit.edu".format(get_vm_node(proxmox, vmid))
|
node = "{}.csh.rit.edu".format(get_vm_node(proxmox, vmid))
|
||||||
tunnel = start_ssh_tunnel(node, port)
|
print("Creating SSH tunnel to {} for VM {}.".format(node, vmid))
|
||||||
|
try:
|
||||||
|
tunnel = start_ssh_tunnel(node, port)
|
||||||
|
except:
|
||||||
|
print('SSH tunnel already exists.')
|
||||||
ssh_tunnels.append(tunnel)
|
ssh_tunnels.append(tunnel)
|
||||||
|
start_vm_vnc(proxmox, vmid)
|
||||||
return token, 200
|
return token, 200
|
||||||
else:
|
else:
|
||||||
return '', 403
|
return '', 403
|
||||||
|
|
|
@ -812,7 +812,7 @@ $("#console-vm").click(function(){
|
||||||
}).then((response) => {
|
}).then((response) => {
|
||||||
return response.text()
|
return response.text()
|
||||||
}).then((token) => {
|
}).then((token) => {
|
||||||
window.location = `/static/noVNC/vnc.html?autoconnect=true&?encrypt=true&?host=proxstar.csh.rit.edu&?port=8081&?path=path?token=${token}`;
|
window.location = `/static/noVNC/vnc.html?autoconnect=true&?encrypt=true&?host=proxstar-vnc.csh.rit.edu&?port=443&?path=path?token=${token}`;
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
if (err) {
|
if (err) {
|
||||||
swal("Uh oh...", `Unable to start console for ${vmname}. Please try again later.`, "error");
|
swal("Uh oh...", `Unable to start console for ${vmname}. Please try again later.`, "error");
|
||||||
|
|
Loading…
Reference in a new issue