This commit is contained in:
Will Nilges 2022-07-11 23:03:30 -04:00
parent 987675326d
commit 5332fa457c
3 changed files with 34 additions and 32 deletions

View file

@ -21,7 +21,9 @@ def stop_websockify():
time.sleep(1) time.sleep(1)
if subprocess.run(['pgrep', 'websockify'], stdout=subprocess.PIPE, check=False).stdout: if subprocess.run(['pgrep', 'websockify'], stdout=subprocess.PIPE, check=False).stdout:
time.sleep(5) time.sleep(5)
if subprocess.run(['pgrep', 'websockify'], stdout=subprocess.PIPE, check=False).stdout: if subprocess.run(
['pgrep', 'websockify'], stdout=subprocess.PIPE, check=False
).stdout:
logging.info("websockify didn't stop, killing forcefully") logging.info("websockify didn't stop, killing forcefully")
subprocess.run(['kill', '-9', pid], stdout=subprocess.PIPE, check=False) subprocess.run(['kill', '-9', pid], stdout=subprocess.PIPE, check=False)
@ -125,16 +127,16 @@ def start_ssh_tunnel(node, port):
# # Tear down the SSH tunnel and VNC target entry for a given VM # # Tear down the SSH tunnel and VNC target entry for a given VM
# print(f'This code is useless') # print(f'This code is useless')
# pass # pass
# port = 5900 + int(vmid) # port = 5900 + int(vmid)
# tunnel = next((tunnel for tunnel in ssh_tunnels if tunnel.local_bind_port == port), None) # tunnel = next((tunnel for tunnel in ssh_tunnels if tunnel.local_bind_port == port), None)
# if tunnel: # if tunnel:
# logging.info('tearing down SSH tunnel for VM %s', vmid) # logging.info('tearing down SSH tunnel for VM %s', vmid)
# try: # try:
# tunnel.stop() # tunnel.stop()
# except: # except:
# pass # pass
# ssh_tunnels.remove(tunnel) # ssh_tunnels.remove(tunnel)
# delete_vnc_target(port) # delete_vnc_target(port)
# def send_stop_ssh_tunnel(vmid): # def send_stop_ssh_tunnel(vmid):