fix: ssh-keyscan failures are warnings, not fatal in deploy-keys

ssh-keyscan failures no longer set Success=false. Keys were uploaded
successfully which is the critical part. Only session errors remain as
errors, ssh-keyscan failures are advisory.
This commit is contained in:
2026-07-09 21:19:52 -04:00
parent 0a42f157f7
commit 7a88fb861d
+1 -3
View File
@@ -140,12 +140,11 @@ func DeployKeysToMachine(ctx context.Context, serverKeyPath string, host string,
result.Messages = append(result.Messages, fmt.Sprintf("Uploaded %s to %s:%s", filepath.Base(k.LocalPath), host, k.RemotePath))
}
if len(knownHostsHosts) > 0 {
if len(knownHostsHosts) > 0 {
for _, khHost := range knownHostsHosts {
session2, err := conn.NewSession()
if err != nil {
result.Errors = append(result.Errors, fmt.Sprintf("session for ssh-keyscan %s: %v", khHost, err))
result.Success = false
continue
}
session2.Stdout = &stdout
@@ -155,7 +154,6 @@ func DeployKeysToMachine(ctx context.Context, serverKeyPath string, host string,
if err != nil {
slog.Warn("deploy: ssh-keyscan failed", "host", khHost, "error", err)
result.Errors = append(result.Errors, fmt.Sprintf("ssh-keyscan %s: %v (stderr: %s)", khHost, err, stderr.String()))
result.Success = false
} else {
result.Messages = append(result.Messages, fmt.Sprintf("Populated known_hosts with %s", khHost))
}