Skip to main content

ssh_exec

Function ssh_exec 

Source
pub async fn ssh_exec(
    host: &str,
    port: u16,
    user: &str,
    pass: &str,
    cmd: &str,
) -> Result<String>
Expand description

Run one command over SSH (password auth), returning stdout. Host key is accepted blind (loopback NAT to our own guest; the key changes on every reinstall, so TOFU is pointless).

Stderr is not echoed unconditionally: healthy guests produce plenty of it (the readiness probe reads registry keys that legitimately don’t exist yet), and printing every line made normal runs look broken. It is reported loudly only in the case that used to bite — empty stdout, where a broken command would otherwise masquerade as empty output — and otherwise at tracing::debug! (RUST_LOG=debug). The caller decides what stdout means.

NB: never log cmd itself — it may carry a password.