start worked from protobuf
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
970e6c24dc
commit
170f548a61
7
Makefile
7
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
|
||||
|
|
10
http.go
10
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)
|
||||
|
|
2
start.go
2
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)
|
||||
|
|
Loading…
Reference in New Issue