1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-11-10 04:06:47 +00:00

fix(console): a serial console whose VM was deleted meanwhile says so

consolecallback read the VM's record with .get(): one deleted between
socketiod's accept and the worker's start ended with a Python traceback
in the user's terminal, which is the worker's stderr. It now says the VM
is no longer in the panel.
This commit is contained in:
catborise 2026-11-05 18:39:21 +03:00
parent c8fb778d08
commit 51aa712802
2 changed files with 11 additions and 1 deletions

View file

@ -115,7 +115,10 @@ def main():
if os.environ.get("CONSOLECALLBACK_LOG_FD"):
log.addHandler(logging.StreamHandler(os.fdopen(int(os.environ["CONSOLECALLBACK_LOG_FD"]), "w", buffering=1)))
log.propagate = False
instance = Instance.objects.select_related("compute").get(pk=int(sys.argv[1]))
instance = Instance.objects.select_related("compute").filter(pk=int(sys.argv[1])).first()
if instance is None: # deleted since socketiod accepted the token
say("The VM is no longer in the panel")
sys.exit(1)
user_id = int(sys.argv[2])
c = instance.compute
try: