try{300,301,400}: fix
This commit is contained in:
@@ -45,7 +45,6 @@ def check_machine_ssh_login(
|
||||
["true"],
|
||||
RunOpts(timeout=opts.timeout, needs_user_terminal=True),
|
||||
)
|
||||
return
|
||||
except ClanCmdTimeoutError as e:
|
||||
msg = f"SSH login timeout after {opts.timeout}s"
|
||||
raise ClanError(msg) from e
|
||||
@@ -54,6 +53,8 @@ def check_machine_ssh_login(
|
||||
raise ClanError(e.cmd.stderr.strip()) from e
|
||||
msg = f"SSH login failed: {e}"
|
||||
raise ClanError(msg) from e
|
||||
else:
|
||||
return
|
||||
|
||||
|
||||
@API.register
|
||||
|
||||
@@ -158,15 +158,15 @@ def read_qr_image(image_path: Path) -> dict[str, Any]:
|
||||
try:
|
||||
res = run(cmd)
|
||||
data = res.stdout.strip()
|
||||
|
||||
if not data:
|
||||
msg = f"No QR code found in image: {image_path}"
|
||||
raise ClanError(msg)
|
||||
|
||||
return json.loads(data)
|
||||
except json.JSONDecodeError as e:
|
||||
msg = f"Invalid JSON in QR code: {e}"
|
||||
raise ClanError(msg) from e
|
||||
except Exception as e:
|
||||
except OSError as e:
|
||||
msg = f"Failed to read QR code from {image_path}: {e}"
|
||||
raise ClanError(msg) from e
|
||||
|
||||
if not data:
|
||||
msg = f"No QR code found in image: {image_path}"
|
||||
raise ClanError(msg)
|
||||
|
||||
return json.loads(data)
|
||||
|
||||
Reference in New Issue
Block a user