Fix vnc target redis crash

This commit is contained in:
Will Nilges 2022-08-25 23:36:41 -04:00
parent 40ab5a31ee
commit 63a2bab3cd
2 changed files with 5 additions and 2 deletions

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)