mirror of
https://github.com/ComputerScienceHouse/proxstar.git
synced 2025-03-09 15:40:09 +00:00
Properly delete keys from Redis
This commit is contained in:
parent
5a28460db0
commit
19b508fe2e
3 changed files with 15 additions and 6 deletions
|
@ -68,3 +68,10 @@ If you're trying to run this all on a VM without a graphical web browser, you ca
|
||||||
ssh example@dev-server.csh.rit.edu -L 8000:localhost:8000 -L 8001:localhost:8001
|
ssh example@dev-server.csh.rit.edu -L 8000:localhost:8000 -L 8001:localhost:8001
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Firing off Jobs
|
||||||
|
|
||||||
|
To fire off a targets cleanup job, run a curl request:
|
||||||
|
|
||||||
|
```
|
||||||
|
curl -X POST http://localhost:8000/console/cleanup -F 'token={VNC_CLEANUP_TOKEN}'
|
||||||
|
```
|
||||||
|
|
|
@ -596,7 +596,14 @@ def cleanup_vnc():
|
||||||
print('Cleaning up targets file...')
|
print('Cleaning up targets file...')
|
||||||
with open(app.config['WEBSOCKIFY_TARGET_FILE'], 'w') as targets:
|
with open(app.config['WEBSOCKIFY_TARGET_FILE'], 'w') as targets:
|
||||||
targets.truncate()
|
targets.truncate()
|
||||||
return '', 200
|
print('Clearing vnc tokens from Redis...')
|
||||||
|
count = 0
|
||||||
|
ns_keys = 'vnc_token*'
|
||||||
|
for key in redis_conn.scan_iter(ns_keys):
|
||||||
|
redis_conn.delete(key)
|
||||||
|
count += 1
|
||||||
|
print(f'Deleted {count} key(s).')
|
||||||
|
return '', 200
|
||||||
print('Got bad cleanup request')
|
print('Got bad cleanup request')
|
||||||
return '', 403
|
return '', 403
|
||||||
|
|
||||||
|
|
|
@ -243,12 +243,7 @@ def cleanup_vnc_task():
|
||||||
ones every couple of minutes
|
ones every couple of minutes
|
||||||
https://github.com/ComputerScienceHouse/proxstar/issues/153
|
https://github.com/ComputerScienceHouse/proxstar/issues/153
|
||||||
"""
|
"""
|
||||||
print('Clearing vnc targets')
|
|
||||||
with open(app.config['WEBSOCKIFY_TARGET_FILE'], 'w') as targets:
|
|
||||||
targets.truncate()
|
|
||||||
|
|
||||||
# FIXME (willnilges): This... might be working...?
|
# FIXME (willnilges): This... might be working...?
|
||||||
|
|
||||||
try:
|
try:
|
||||||
requests.post(
|
requests.post(
|
||||||
'https://{}/console/cleanup'.format(app.config['SERVER_NAME']),
|
'https://{}/console/cleanup'.format(app.config['SERVER_NAME']),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue