From afd0fdebfe83e8bab4b383b983d4df3851c1feab Mon Sep 17 00:00:00 2001 From: Nick White Date: Tue, 24 Sep 2019 18:53:41 +0100 Subject: Improve ssh logs; ensure only fully operational servers are tried, and ensure connections to new ips not in known_hosts still succeed --- bookpipeline/cmd/lspipeline/main.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/bookpipeline/cmd/lspipeline/main.go b/bookpipeline/cmd/lspipeline/main.go index 4a131b4..21af20d 100644 --- a/bookpipeline/cmd/lspipeline/main.go +++ b/bookpipeline/cmd/lspipeline/main.go @@ -149,9 +149,9 @@ func getRecentSSHLogs(ip string, id string, n int) (string, error) { logcmd := fmt.Sprintf("journalctl -n %d -u bookpipeline", n) var cmd *exec.Cmd if id == "" { - cmd = exec.Command("ssh", addr, logcmd) + cmd = exec.Command("ssh", "-o", "StrictHostKeyChecking no", addr, logcmd) } else { - cmd = exec.Command("ssh", "-i", id, addr, logcmd) + cmd = exec.Command("ssh", "-o", "StrictHostKeyChecking no", "-i", id, addr, logcmd) } out, err := cmd.Output() if err != nil { @@ -212,7 +212,9 @@ func main() { } if i.Ip != "" { fmt.Printf(", IP: %s", i.Ip) - ips = append(ips, i.Ip) + if i.State == "running" { + ips = append(ips, i.Ip) + } } if i.Spot != "" { fmt.Printf(", SpotRequest: %s", i.Spot) -- cgit v1.2.1-24-ge1ad