mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-11-20 23:16:17 -05:00
Controller logs: an unparseable since is a 400, not empty logs (#953)
journalctl exits 1 with nothing on stdout when it cannot parse --since (a bare "1h" is one such value); the controller returned that empty stdout as the logs, with a 200. A failed journalctl is now an error: 400 when it could not parse since, 500 otherwise. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
d25ebb9e63
commit
f3f762ef1b
4 changed files with 51 additions and 3 deletions
|
|
@ -159,6 +159,8 @@ async def service_logs(
|
|||
result = get_service_logs(name, lines, since)
|
||||
|
||||
if "error" in result:
|
||||
raise HTTPException(status_code=500, detail=result["error"])
|
||||
# A since journalctl cannot parse is the caller's mistake.
|
||||
status_code = 400 if result.get("invalid_since") else 500
|
||||
raise HTTPException(status_code=status_code, detail=result["error"])
|
||||
|
||||
return ServiceLogsResponse(**result)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue