Skip to main content

Module sshdiag

Module sshdiag 

Source
Expand description

Turn raw ssh stderr into an actionable diagnosis.

Diagnosis is pure and always-on: hostcmd::host_add’s probe-failure path classifies the underlying ssh error and, when it recognizes the shape, prints a hint alongside it — never in place of it. The doing (host setup-key, Task 2) is a separate, explicit command; this module only looks and tells.

Enums§

SshDiagnosis
What went wrong establishing an SSH connection, as inferred from stderr.

Functions§

classify_ssh_error
Classify stderr from a failed ssh invocation. Substring match, most specific first: HostKeyChanged and ConnectionRefused are checked before the more generic Unreachable/PermissionDenied, and PermissionDenied’s “Permission denied”/“publickey” are checked before falling back to Other.
diagnosis_message
An actionable, multi-line hint for d — empty for Other, so the caller falls back to the raw ssh error rather than showing a blank line.