Merge pull request #165 from ComputerScienceHouse/willnilges/fix-vmid-crash

Fix vnc target redis crash
This commit is contained in:
Willard Nilges 2022-08-31 20:33:07 -04:00 committed by GitHub
commit 4f7655ca6b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

View file

@ -3,4 +3,4 @@ podman run --rm -d --network=proxstar --name=proxstar-redis redis:alpine
podman run --rm -d --network=proxstar --name=proxstar-postgres -e POSTGRES_PASSWORD=changeme -v ./HACKING/proxstar-postgres/volume:/var/lib/postgresql/data:Z proxstar-postgres
podman run --rm -d --network=proxstar --name=proxstar-rq-scheduler --env-file=HACKING/.env --entrypoint ./start_scheduler.sh proxstar
podman run --rm -d --network=proxstar --name=proxstar-rq --env-file=HACKING/.env --entrypoint ./start_worker.sh proxstar
podman run --rm -it --network=proxstar --name=proxstar -p 8000:8000 -p 8081:8081 --env-file=HACKING/.env --entrypoint='["gunicorn", "proxstar:app", "--bind=0.0.0.0:8000"]' proxstar
podman run --rm -it --network=proxstar --name=proxstar -p 8000:8000 -p 8001:8001 --env-file=HACKING/.env --entrypoint='["gunicorn", "proxstar:app", "--bind=0.0.0.0:8000"]' proxstar

View file

@ -254,7 +254,10 @@ def vm_power(vmid, action):
vm = VM(vmid)
vnc_token_key = f'vnc_token|{vmid}'
# For deleting the token from redis later
vnc_token = redis_conn.get(vnc_token_key).decode('utf-8')
try:
vnc_token = redis_conn.get(vnc_token_key).decode('utf-8')
except AttributeError as e:
print(f'Error: Could not get vnc_token:{e}')
if action == 'start':
vmconfig = vm.config
usage_check = user.check_usage(vmconfig['cores'], vmconfig['memory'], 0)