summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick White <git@njw.name>2019-09-24 18:53:41 +0100
committerNick White <git@njw.name>2019-09-24 18:53:41 +0100
commitafd0fdebfe83e8bab4b383b983d4df3851c1feab (patch)
treec5294ccfcc3ef0774267efae9cdca2efcc13a6d7
parent46dae3fb7d431aa95ae645b97d60c1fb1d6e9daa (diff)
Improve ssh logs; ensure only fully operational servers are tried, and ensure connections to new ips not in known_hosts still succeed
-rw-r--r--bookpipeline/cmd/lspipeline/main.go8
1 files 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)