zookeeper is working again

This commit is contained in:
Jeff Carr 2025-02-16 12:02:47 -06:00
parent 94b1881d41
commit 2152a6477f
1 changed files with 15 additions and 14 deletions

29
send.go
View File

@ -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)