summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-10-26 20:09:33 -0500
committerJeff Carr <[email protected]>2024-10-26 20:09:33 -0500
commit170f548a619b0380acb8137f24ffce0478e0b753 (patch)
tree33872391a050d9f6be9a2c4df79450a9d1cf3d77
parent970e6c24dc98d81e1726db3afe1dca8a67ad4832 (diff)
start worked from protobuf
Signed-off-by: Jeff Carr <[email protected]>
-rw-r--r--Makefile7
-rw-r--r--http.go10
-rw-r--r--start.go2
3 files changed, 13 insertions, 6 deletions
diff --git a/Makefile b/Makefile
index d800fa1..96a6537 100644
--- a/Makefile
+++ b/Makefile
@@ -37,9 +37,8 @@ git-clone:
# go-clone --recursive --go-src --no-work go.wit.com/apps/go-clone
go-clone --recursive --go-src --no-work go.wit.com/lib/daemons/virtigod
-start:
- rm -f /tmp/pihole.wit.com.xml
- ./virtigod --start pihole.wit.com
-
start-pihole.wit.com-http:
curl --silent http://localhost:8080/start?start=pihole.wit.com
+
+start-bind.wit.com-http:
+ curl --silent http://localhost:8080/start?start=bind.wit.com
diff --git a/http.go b/http.go
index 746ef9b..5fb63f6 100644
--- a/http.go
+++ b/http.go
@@ -68,6 +68,7 @@ func okHandler(w http.ResponseWriter, r *http.Request) {
}
if tmp == "/start" {
+ log.Info("/start jcarr actually doing START")
fmt.Fprintln(w, "/start jcarr actually doing START")
start := r.URL.Query().Get("start")
xml := "/tmp/" + start + ".xml"
@@ -79,6 +80,7 @@ func okHandler(w http.ResponseWriter, r *http.Request) {
}
// fmt.Fprintln(w, "HTTP:", r.Body)
var d *pb.Droplet
+ d = new(pb.Droplet)
// msg, err := ioutil.ReadAll(r.Body) // Read the body as []byte
fmt.Fprintln(w, "/start ReadAll() START")
fmt.Fprintln(w, "msg =", string(msg))
@@ -89,7 +91,13 @@ func okHandler(w http.ResponseWriter, r *http.Request) {
return
}
fmt.Fprintln(w, "START len(msg) =", len(msg))
- // err = d.UnmarshalJSON(msg)
+ err = d.UnmarshalJSON(msg)
+ if d.Hostname == "" {
+ fmt.Fprintln(w,"START hostname is blank")
+ log.Info("START hostname is blank")
+ return
+ }
+
if err != nil {
fmt.Fprintln(w, "START FAILED")
fmt.Fprintln(w, "error =", err)
diff --git a/start.go b/start.go
index 7c28f76..4bd3844 100644
--- a/start.go
+++ b/start.go
@@ -14,7 +14,7 @@ import (
func newStart(start string, d *pb.Droplet) error {
// d := me.cluster.FindDroplet(start)
if d == nil {
- log.Info("droplet is unknown:", start)
+ log.Info("log.Info: droplet is unknown:", start)
return errors.New("droplet is unknown: " + start)
}
log.Info("start droplet here:", d.Hostname)