This commit is contained in:
Joe Abbate 2022-10-19 23:12:48 -04:00
parent ade55e3d1f
commit 29aaf85738
No known key found for this signature in database
GPG key ID: 7F1CC23828058430
3 changed files with 3 additions and 5 deletions

View file

@ -2,6 +2,7 @@ import os
import subprocess
from flask import Flask
app = Flask(__name__)
if os.path.exists(os.path.join(app.config.get('ROOT_DIR', os.getcwd()), "config_local.py")):
config = os.path.join(app.config.get('ROOT_DIR', os.getcwd()), "config_local.py")

View file

@ -335,9 +335,7 @@ def vm_console(vmid):
if user.rtp or int(vmid) in user.allowed_vms:
# import pdb; pdb.set_trace()
vm = VM(vmid)
vnc_ticket, vnc_port = open_vnc_session(
vmid, vm.node, proxmox
)
vnc_ticket, vnc_port = open_vnc_session(vmid, vm.node, proxmox)
node = f'{vm.node}.csh.rit.edu'
token = add_vnc_target(node, vnc_port)
redis_conn.set(f'vnc_token|{vmid}', str(token)) # Store the VNC token in Redis.

View file

@ -3,7 +3,6 @@ import subprocess
import time
import urllib.parse
import requests
from flask import current_app as app
from proxstar import logging
@ -85,4 +84,4 @@ def open_vnc_session(vmid, node, proxmox):
params = {'websocket': '1', 'generate-password': '0'}
vncproxy_response_data = proxmox.nodes(node).qemu(str(vmid)).vncproxy.post(**params)
return urllib.parse.quote_plus(vncproxy_response_data['ticket']) vncproxy_response_data['port']
return urllib.parse.quote_plus(vncproxy_response_data['ticket']), vncproxy_response_data['port']