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 { func pingStatus() error {
var url string var url string
url = me.urlbase + "/status?hostname=" + me.forge.Machine.Hostname url = me.urlbase + "/status?hostname=" + me.forge.Machine.Hostname
msg, err := me.forge.Machine.Packages.Marshal() /*
if err != nil { msg, err := me.forge.Machine.Packages.Marshal()
log.Info("proto.Marshal() failed:", err) if err != nil {
return err log.Info("proto.Marshal() failed:", err)
} return err
log.Info("proto Marshal len =", len(msg)) }
body, err := me.forge.HttpPost(url, msg) log.Info("proto Marshal len =", len(msg))
*/
body, err := me.forge.HttpPostMachine(url)
if err != nil { if err != nil {
log.Info("httpPost() failed:", err) log.Info("httpPost() failed:", err)
return err return err
@ -42,23 +45,21 @@ func pingStatus() error {
func sendMachine(s string) error { func sendMachine(s string) error {
var url string var url string
url = me.urlbase + "/machine" url = me.urlbase + "/machine"
msg, err := me.forge.Machine.Marshal() body, err := me.forge.HttpPostMachine(url)
if err != nil {
log.Info("proto.Marshal() failed:", err)
return err
}
body, err := me.forge.HttpPost(url, msg)
if err != nil { if err != nil {
log.Info("httpPost() failed: url", url) log.Info("httpPost() failed: url", url)
log.Info("httpPost() failed:", err) log.Info("httpPost() failed:", err)
log.Info("httpPost() data:", string(body))
return err return err
} }
out := strings.TrimSpace(string(body))
log.Info("httpPost() data:", out, len(body))
test := strings.TrimSpace(string(body)) test := strings.TrimSpace(string(body))
// log.Info("virtigo returned body:", test) // log.Info("virtigo returned body:", test)
for _, line := range strings.Split(test, "\n") { for _, line := range strings.Split(test, "\n") {
if line == "upgrade" { if line == "upgrade" {
log.Info(s, "zookeeper is healthy", len(msg)) log.Info(s, "zookeeper is healthy")
me.failcount = 0 me.failcount = 0
} else if line == "kill" { } else if line == "kill" {
os.Exit(0) os.Exit(0)