summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile.help1
-rw-r--r--http.go13
2 files changed, 13 insertions, 1 deletions
diff --git a/Makefile.help b/Makefile.help
index da38520..a5116b0 100644
--- a/Makefile.help
+++ b/Makefile.help
@@ -14,6 +14,7 @@ curl-kill:
curl http://localhost:2520/kill
status:
+ dpkg -s virtigod
systemctl status virtigod.service
enable:
diff --git a/http.go b/http.go
index 85bdbb0..66d7fd0 100644
--- a/http.go
+++ b/http.go
@@ -6,6 +6,7 @@ import (
"os"
"strings"
+ "go.wit.com/lib/gui/shell"
"go.wit.com/log"
)
@@ -17,6 +18,10 @@ func cleanURL(url string) string {
func okHandler(w http.ResponseWriter, r *http.Request) {
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)
log.Info("Got URL:", tmp)
@@ -48,7 +53,13 @@ func okHandler(w http.ResponseWriter, r *http.Request) {
if tmp == "/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
}