Skip to content

list-routes: fail cleanly instead of dumping a traceback when traefik is unreachable - #147

Closed
stephdl wants to merge 2 commits into
mainfrom
fix/list-routes-graceful-degradation
Closed

stephdl wants to merge 2 commits into
mainfrom
fix/list-routes-graceful-degradation

Conversation

@stephdl

@stephdl stephdl commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

Related to NethServer/dev#8171

When traefik is stopped but the node itself is reachable, list-routes raised a generic Exception on ConnectionRefusedError, printing a full three-level traceback and aborting the task.

ns8-core PR #1317 now detects this exact condition separately via get-status and labels it in the UI ("Traefik is stopped on {node}"). I first tried making list-routes return an empty list on success instead of failing, but that removes the only fallback: if the get-status check ever misses a case, the UI would silently show fewer routes with no error at all.

Instead, this keeps the task failing (aborted, same as before) so that fallback stays in place, but replaces the unhandled exception with a single clean stderr line and a plain exit 1. No more traceback noise in the journal, no loss of signal.

Tested on a live cluster with traefik stopped on one node: one clean stderr line, task status aborted (1), no traceback.

…is unreachable

When the traefik service is stopped but the node is reachable, list-routes
raised a generic Exception on ConnectionRefusedError, printing a full
traceback and aborting the task. This is a known, expected condition
(the core UI already detects and labels it via get-status), so it
doesn't need to fail here.

get_route() already supports returning an empty result for this exact
case via ignore_error, and the output schema already lists an empty
array as a valid result. I apply the same convention to the primary
router-listing call: log one line to stderr and return an empty list
with a normal exit code, instead of raising.
Returning an empty list on a stopped traefik removed the only
fallback signal for this condition: if the core-side get-status check
that labels it explicitly ever misses a case, the UI would show fewer
routes with no error at all.

Keep failing here as a safety net, but stop at one clean stderr line
instead of an unhandled exception and its three-level traceback.
@stephdl stephdl changed the title list-routes: return empty list instead of aborting when traefik is unreachable list-routes: fail cleanly instead of dumping a traceback when traefik is unreachable Sep 18, 2026
@stephdl stephdl closed this Sep 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant