summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-10-16 20:38:51 -0500
committerJeff Carr <[email protected]>2024-10-16 20:38:51 -0500
commit84390c4ebce12ee2ae6359c09e682778e0406bc1 (patch)
tree06da80ceec65174c5083c706342db8a2278ec13c
parent86df520638e22e1ee42b1fe30672fa2473b5a6ad (diff)
attempt to send start output back
Signed-off-by: Jeff Carr <[email protected]>
-rw-r--r--http.go17
1 files changed, 14 insertions, 3 deletions
diff --git a/http.go b/http.go
index 66d7fd0..350f072 100644
--- a/http.go
+++ b/http.go
@@ -55,11 +55,22 @@ func okHandler(w http.ResponseWriter, r *http.Request) {
start := r.URL.Query().Get("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")
+
+ fmt.Fprintln(w, "Handling URL:", tmp, "start droplet")
log.Warn("cmd :", cmd)
+
+ fmt.Fprintln(w, "Handling URL:", tmp, "start droplet")
+ fmt.Fprintln(w, "cmd: ", cmd)
+ err, ok, output := shell.RunCmd("/home/", cmd)
shell.Run(cmd)
+ if ok {
+ fmt.Fprintln(w, "START OK")
+ fmt.Fprintln(w, output)
+ } else {
+ fmt.Fprintln(w, "START FAILED")
+ fmt.Fprintln(w, "error =", err)
+ fmt.Fprintln(w, "output =", output)
+ }
return
}