start works from the command line
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
5b47c44fb5
commit
86df520638
|
@ -14,6 +14,7 @@ curl-kill:
|
||||||
curl http://localhost:2520/kill
|
curl http://localhost:2520/kill
|
||||||
|
|
||||||
status:
|
status:
|
||||||
|
dpkg -s virtigod
|
||||||
systemctl status virtigod.service
|
systemctl status virtigod.service
|
||||||
|
|
||||||
enable:
|
enable:
|
||||||
|
|
13
http.go
13
http.go
|
@ -6,6 +6,7 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"go.wit.com/lib/gui/shell"
|
||||||
"go.wit.com/log"
|
"go.wit.com/log"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -17,6 +18,10 @@ func cleanURL(url string) string {
|
||||||
|
|
||||||
func okHandler(w http.ResponseWriter, r *http.Request) {
|
func okHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
var tmp string
|
var tmp string
|
||||||
|
|
||||||
|
log.Info("Got URL Path: ", r.URL.Path)
|
||||||
|
log.Info("Got URL Query:", r.URL.Query().Get("start"))
|
||||||
|
|
||||||
tmp = cleanURL(r.URL.Path)
|
tmp = cleanURL(r.URL.Path)
|
||||||
|
|
||||||
log.Info("Got URL:", tmp)
|
log.Info("Got URL:", tmp)
|
||||||
|
@ -48,7 +53,13 @@ func okHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
|
|
||||||
if tmp == "/start" {
|
if tmp == "/start" {
|
||||||
start := r.URL.Query().Get("start")
|
start := r.URL.Query().Get("start")
|
||||||
fmt.Fprint(w,"Handling URL:", tmp, "should start here: droplet", start)
|
xml := "/root/jcarr/machines/autostart/" + start + ".xml"
|
||||||
|
cmd := []string{"virsh", "create", xml}
|
||||||
|
fmt.Fprintln(w, "Handling URL:", tmp, "should start here: droplet")
|
||||||
|
fmt.Fprintln(w, "start returned: ", start)
|
||||||
|
log.Warn("should start droplet", start, "here")
|
||||||
|
log.Warn("cmd :", cmd)
|
||||||
|
shell.Run(cmd)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue