Merge branch 'master' of https://repositories.action2quare.com/ayo/houston
This commit is contained in:
@ -6,6 +6,7 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
"path"
|
"path"
|
||||||
|
"strconv"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"repositories.action2quare.com/ayo/go-ayo/logger"
|
"repositories.action2quare.com/ayo/go-ayo/logger"
|
||||||
@ -180,13 +181,38 @@ func (h *houstonHandler) StartProcess(w http.ResponseWriter, r *http.Request) {
|
|||||||
Version: version,
|
Version: version,
|
||||||
Args: args, // 실행 파일 포함 e.g. "biglocal.exe -port=8090 -dev",
|
Args: args, // 실행 파일 포함 e.g. "biglocal.exe -port=8090 -dev",
|
||||||
}, targets))
|
}, targets))
|
||||||
|
}
|
||||||
// svr.Operation().Start(server.MakeStartRequest(
|
|
||||||
// common.StartRequest{
|
func (h *houstonHandler) StopProcess(w http.ResponseWriter, r *http.Request) {
|
||||||
// Name: "warehouse",
|
// <form action="/houston" method="post" enctype="multipart/form-data">
|
||||||
// Version: "latest",
|
// <input type="text" name="name">
|
||||||
// Args: "biglocal.exe -port=8090 -dev",
|
// <input type="text" name="version">
|
||||||
// },
|
// <input type="text" name="args">
|
||||||
// []string{"mountain"},
|
// <input type="text" name="targets">
|
||||||
// ))
|
// <input type="submit" value="업로드">
|
||||||
|
// </form>
|
||||||
|
name := r.FormValue("name")
|
||||||
|
if len(name) == 0 {
|
||||||
|
w.WriteHeader(http.StatusBadRequest)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
version := r.FormValue("version") // option
|
||||||
|
pidstr := r.FormValue("pid") // option
|
||||||
|
traws := r.FormValue("targets")
|
||||||
|
|
||||||
|
var targets []string
|
||||||
|
if err := json.Unmarshal([]byte(traws), &targets); err != nil {
|
||||||
|
logger.Error(err)
|
||||||
|
w.WriteHeader(http.StatusBadRequest)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
pid, _ := strconv.Atoi(pidstr)
|
||||||
|
|
||||||
|
h.Operation().StopProcess(MakeStopProcessRequest(shared.StopProcessRequest{
|
||||||
|
Name: name,
|
||||||
|
Version: version,
|
||||||
|
Pid: int32(pid),
|
||||||
|
}, targets))
|
||||||
}
|
}
|
||||||
|
|||||||
@ -41,7 +41,7 @@ func NewHoustonHandler() HoustonServerWithHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (h *houstonHandler) RegisterHandlers(serveMux *http.ServeMux, prefix string) error {
|
func (h *houstonHandler) RegisterHandlers(serveMux *http.ServeMux, prefix string) error {
|
||||||
serveMux.Handle(path.Join(prefix, "houston"), h)
|
serveMux.Handle("/"+path.Join(prefix, "houston"), h)
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
@ -58,7 +58,7 @@ type StopProcessRequest struct {
|
|||||||
hostnames []string
|
hostnames []string
|
||||||
}
|
}
|
||||||
|
|
||||||
func MakeStopRequest(req shared.StopProcessRequest, targets []string) StopProcessRequest {
|
func MakeStopProcessRequest(req shared.StopProcessRequest, targets []string) StopProcessRequest {
|
||||||
return StopProcessRequest{
|
return StopProcessRequest{
|
||||||
StopProcessRequest: req,
|
StopProcessRequest: req,
|
||||||
hostnames: targets,
|
hostnames: targets,
|
||||||
|
|||||||
Reference in New Issue
Block a user