File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -367,6 +367,18 @@ def op_console(ctx):
367367 """POST /v1/vms/{name}/console — obtain VNC bridge connection info."""
368368 url = f"{ ctx .agent .base_url } /vms/{ ctx .vm_name } /console"
369369 data = _json_or_fail (_req ("POST" , url , ctx .agent ))
370+ console_obj = data .get ("console" )
371+ if isinstance (console_obj , dict ):
372+ host = console_obj .get ("host" )
373+ port = console_obj .get ("port" )
374+ password = console_obj .get ("password" )
375+ if host and port and password :
376+ try :
377+ console_obj ["port" ] = int (port )
378+ except (TypeError , ValueError ):
379+ _fail (f"Invalid port value returned by agent: { port } " )
380+ _ok (data )
381+ # fallthrough if malformed
370382 console_host = getattr (ctx .agent , "console_host" , "" ) or ""
371383 resp_host = data .get ("host" )
372384 if console_host and (not resp_host or resp_host in {"0.0.0.0" , "127.0.0.1" , "::" }):
You can’t perform that action at this time.
0 commit comments