summaryrefslogtreecommitdiff
path: root/http.go
diff options
context:
space:
mode:
Diffstat (limited to 'http.go')
-rw-r--r--http.go49
1 files changed, 2 insertions, 47 deletions
diff --git a/http.go b/http.go
index b652333..abf7983 100644
--- a/http.go
+++ b/http.go
@@ -5,7 +5,6 @@ import (
"net/http"
"strings"
- pb "go.wit.com/lib/protobuf/virtbuf"
"go.wit.com/lib/virtigoxml"
"go.wit.com/log"
)
@@ -23,18 +22,7 @@ func okHandler(w http.ResponseWriter, r *http.Request) {
// is the cluster running what it should?
if tmp == "/droplets" {
for _, d := range me.cluster.Droplets {
- if d.StartState != pb.DropletState_ON {
- continue
- }
- /*
- dur := time.Since(d.Lastpoll) // Calculate the elapsed time
- if d.CurrentState != pb.DropletState_ON {
- fmt.Fprintln(w, "BAD STATE ", d.Hostname, hname, "(", d.StartState, "vs", d.CurrentState, ")", shell.FormatDuration(dur))
- } else {
- dur := time.Since(d.lastpoll) // Calculate the elapsed time
- fmt.Fprintln(w, "GOOD STATE ON", d.Hostname, hname, shell.FormatDuration(dur))
- }
- */
+ fmt.Fprintln(w, "", d.Hostname, "(", d.StartState, "vs", d.CurrentState, ")")
}
return
}
@@ -52,15 +40,6 @@ func okHandler(w http.ResponseWriter, r *http.Request) {
return
}
- /*
- if tmp == "/writeconfig" {
- writeConfigFile()
- writeConfigFileDroplets()
- fmt.Fprintln(w, "OK")
- return
- }
- */
-
if tmp == "/dumplibvirtxml" {
virtigoxml.DumpLibvirtxmlDomainNames()
return
@@ -75,28 +54,6 @@ func okHandler(w http.ResponseWriter, r *http.Request) {
log.Info("Handling URL:", tmp, "cluster is not right yet", s)
fmt.Fprintln(w, s)
}
- /*
- for _, h := range me.hypers {
- url := "http://" + h.pb.Hostname + ":2520/kill"
- dur := time.Since(h.lastpoll) // Calculate the elapsed time
- if dur > 90*time.Second {
- h.RestartDaemon()
- continue
- }
- if h.killcount != 0 {
- log.Info("KILL count =", h.killcount, "FOR", h.pb.Hostname, dur, "curl", url)
- }
- if h.killcount > 10 {
- log.Info("KILL count is greater than 10 for host", h.pb.Hostname, dur, "curl", url)
- }
- // l := shell.FormatDuration(dur)
- // log.Warn("HOST =", h.pb.Hostname, "Last poll =", l)
- //if d.pb.StartState != "ON" {
- // continue
- //}
- // dur := time.Since(d.lastpoll) // Calculate the elapsed time
- }
- */
return
}
@@ -112,12 +69,10 @@ func okHandler(w http.ResponseWriter, r *http.Request) {
log.Warn("BAD URL =", tmp)
fmt.Fprintln(w, "BAD URL", tmp)
- // badurl(w, r.URL.String())
- // fmt.Fprintln(w, "BAD", tmp)
}
+// write a file out to the http socket
func writeFile(w http.ResponseWriter, filename string) {
- // fmt.Fprintln(w, "GOT TEST?")
fullname := "resources/" + filename
pfile, err := resources.ReadFile(fullname)
if err != nil {