ComputerScienceHouse / proxstar

VM self-service tool for Computer Science House that integrates with Proxmox and STARRS
https://csh.rit.edu/projects/2018/04/12/proxstar.html
MIT License
23 stars 21 forks source link

Fix vnc target redis crash #165

Closed WillNilges closed 2 years ago

WillNilges commented 2 years ago

There's a thing that checks for a VMID when starting/stopping/etc-ing a VM. It raises an exception that isn't caught right now. This'll catch it and hopefully stop fucking everything up.

2022-08-25 20:33:27,211 ERROR Exception on /vm/118/power/start [POST]
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 2447, in wsgi_app
    response = self.full_dispatch_request()
  File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 1952, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/usr/local/lib/python3.8/site-packages/ddtrace/contrib/flask/helpers.py", line 25, in wrapper
    return func(pin, wrapped, instance, args, kwargs)
  File "/usr/local/lib/python3.8/site-packages/ddtrace/contrib/flask/helpers.py", line 36, in wrapper
    return wrapped(*args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 1821, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/local/lib/python3.8/site-packages/flask/_compat.py", line 39, in reraise
    raise value
  File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 1950, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/local/lib/python3.8/site-packages/ddtrace/contrib/flask/helpers.py", line 25, in wrapper
    return func(pin, wrapped, instance, args, kwargs)
  File "/usr/local/lib/python3.8/site-packages/ddtrace/contrib/flask/patch.py", line 481, in _traced_request
    return wrapped(*args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 1936, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/usr/local/lib/python3.8/site-packages/ddtrace/contrib/flask/wrappers.py", line 25, in trace_func
    return wrapped(*args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/flask_pyoidc/flask_pyoidc.py", line 253, in wrapper
    return view_func(*args, **kwargs)
  File "/opt/proxstar/proxstar/__init__.py", line 257, in vm_power
    vnc_token = redis_conn.get(vnc_token_key).decode('utf-8')
AttributeError: 'NoneType' object has no attribute 'decode'
WillNilges commented 2 years ago

Fuck. You were right mary, I lied. I knew it would happen, but I was lazy.

Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 2447, in wsgi_app
    response = self.full_dispatch_request()
  File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 1952, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 1821, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/local/lib/python3.8/site-packages/flask/_compat.py", line 39, in reraise
    raise value
  File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 1950, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 1936, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/usr/local/lib/python3.8/site-packages/flask_pyoidc/flask_pyoidc.py", line 253, in wrapper
    return view_func(*args, **kwargs)
  File "/opt/proxstar/proxstar/__init__.py", line 273, in vm_power
    delete_vnc_target(token=vnc_token)
UnboundLocalError: local variable 'vnc_token' referenced before assignment