diff options
| author | Jeff Carr <[email protected]> | 2024-11-18 09:41:08 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2024-11-18 09:41:08 -0600 |
| commit | b71fec22c8cc6c5b3be47bd782a7c807be75216c (patch) | |
| tree | 61194783bc2c839eef5a7566b8eaccc014be078b /send.go | |
| parent | 769c9757b7065dc7bde4543a5347e31606875ff2 (diff) | |
keep working towards update workingv0.0.6
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'send.go')
| -rw-r--r-- | send.go | 21 |
1 files changed, 12 insertions, 9 deletions
@@ -3,6 +3,7 @@ package main import ( + "os" "strings" "go.wit.com/lib/gui/shell" @@ -42,7 +43,7 @@ func pingStatus() error { return nil } -func sendMachine() error { +func sendMachine(s string) error { var url string url = urlbase + "/machine" msg, err := me.machine.Marshal() @@ -50,7 +51,6 @@ func sendMachine() error { log.Info("proto.Marshal() failed:", err) return err } - log.Info("proto Marshal len =", len(msg)) body, err := httpPost(url, msg) if err != nil { log.Info("httpPost() failed:", err) @@ -60,15 +60,18 @@ func sendMachine() error { test := strings.TrimSpace(string(body)) // log.Info("virtigo returned body:", test) for _, line := range strings.Split(test, "\n") { - switch line { - case "upgrade": - log.Info("zookeeper is healthy") - case "apt update": - log.Info("machine upgrade now") + if line == "upgrade" { + log.Info(s, "zookeeper is healthy", len(msg)) + } else if line == "kill" { + os.Exit(0) + } else if strings.HasPrefix(line, "apt update") { + log.Info("machine upgrade now", line) shell.Run([]string{"apt", "update"}) shell.Run([]string{"apt", "install", "zood"}) - default: - log.Info("zookeeper is maybe not working GOT:", line) + log.Sleep(1) + os.Exit(0) + } else { + log.Info(urlbase, "is maybe not working GOT:", line) } } return nil |
