diff options
Diffstat (limited to 'send.go')
| -rw-r--r-- | send.go | 29 |
1 files changed, 15 insertions, 14 deletions
@@ -14,13 +14,16 @@ import ( func pingStatus() error { var url string url = me.urlbase + "/status?hostname=" + me.forge.Machine.Hostname - msg, err := me.forge.Machine.Packages.Marshal() - if err != nil { - log.Info("proto.Marshal() failed:", err) - return err - } - log.Info("proto Marshal len =", len(msg)) - body, err := me.forge.HttpPost(url, msg) + /* + msg, err := me.forge.Machine.Packages.Marshal() + if err != nil { + log.Info("proto.Marshal() failed:", err) + return err + } + log.Info("proto Marshal len =", len(msg)) + */ + + body, err := me.forge.HttpPostMachine(url) if err != nil { log.Info("httpPost() failed:", err) return err @@ -42,23 +45,21 @@ func pingStatus() error { func sendMachine(s string) error { var url string url = me.urlbase + "/machine" - msg, err := me.forge.Machine.Marshal() - if err != nil { - log.Info("proto.Marshal() failed:", err) - return err - } - body, err := me.forge.HttpPost(url, msg) + body, err := me.forge.HttpPostMachine(url) if err != nil { log.Info("httpPost() failed: url", url) log.Info("httpPost() failed:", err) + log.Info("httpPost() data:", string(body)) return err } + out := strings.TrimSpace(string(body)) + log.Info("httpPost() data:", out, len(body)) test := strings.TrimSpace(string(body)) // log.Info("virtigo returned body:", test) for _, line := range strings.Split(test, "\n") { if line == "upgrade" { - log.Info(s, "zookeeper is healthy", len(msg)) + log.Info(s, "zookeeper is healthy") me.failcount = 0 } else if line == "kill" { os.Exit(0) |
