StopProcess 요청 추가
This commit is contained in:
@ -6,6 +6,7 @@ import (
|
||||
"net/http"
|
||||
"os"
|
||||
"path"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"repositories.action2quare.com/ayo/go-ayo/logger"
|
||||
@ -180,13 +181,38 @@ func (h *houstonHandler) StartProcess(w http.ResponseWriter, r *http.Request) {
|
||||
Version: version,
|
||||
Args: args, // 실행 파일 포함 e.g. "biglocal.exe -port=8090 -dev",
|
||||
}, targets))
|
||||
|
||||
// svr.Operation().Start(server.MakeStartRequest(
|
||||
// common.StartRequest{
|
||||
// Name: "warehouse",
|
||||
// Version: "latest",
|
||||
// Args: "biglocal.exe -port=8090 -dev",
|
||||
// },
|
||||
// []string{"mountain"},
|
||||
// ))
|
||||
}
|
||||
|
||||
func (h *houstonHandler) StopProcess(w http.ResponseWriter, r *http.Request) {
|
||||
// <form action="/houston" method="post" enctype="multipart/form-data">
|
||||
// <input type="text" name="name">
|
||||
// <input type="text" name="version">
|
||||
// <input type="text" name="args">
|
||||
// <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 {
|
||||
serveMux.Handle(path.Join(prefix, "houston"), h)
|
||||
serveMux.Handle("/"+path.Join(prefix, "houston"), h)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -58,7 +58,7 @@ type StopProcessRequest struct {
|
||||
hostnames []string
|
||||
}
|
||||
|
||||
func MakeStopRequest(req shared.StopProcessRequest, targets []string) StopProcessRequest {
|
||||
func MakeStopProcessRequest(req shared.StopProcessRequest, targets []string) StopProcessRequest {
|
||||
return StopProcessRequest{
|
||||
StopProcessRequest: req,
|
||||
hostnames: targets,
|
||||
|
||||
Reference in New Issue
Block a user