deleteDeploySource, undeploy 추가
This commit is contained in:
@ -96,6 +96,28 @@ func (h *houstonHandler) UploadDeploySource(w http.ResponseWriter, r *http.Reque
|
||||
}
|
||||
}
|
||||
|
||||
func (h *houstonHandler) DeleteDeploySource(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">
|
||||
// </form>
|
||||
version := r.FormValue("version")
|
||||
name := r.FormValue("name")
|
||||
|
||||
if len(version) == 0 || len(name) == 0 {
|
||||
w.WriteHeader(http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
|
||||
// deploys 폴더는 파일시스템 서비스이므로 다운로드 가능
|
||||
targetpath := path.Join("deploys", name, version)
|
||||
if err := os.RemoveAll(targetpath); err != nil {
|
||||
logger.Println("deleteDeploySource failed :", err)
|
||||
w.WriteHeader(http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
func (h *houstonHandler) Deploy(w http.ResponseWriter, r *http.Request) {
|
||||
// <form action="/houston" method="post" enctype="multipart/form-data">
|
||||
// <input type="text" name="name">
|
||||
@ -157,6 +179,39 @@ func (h *houstonHandler) Deploy(w http.ResponseWriter, r *http.Request) {
|
||||
))
|
||||
}
|
||||
|
||||
func (h *houstonHandler) Undeploy(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="targets">
|
||||
// </form>
|
||||
name := r.FormValue("name")
|
||||
version := r.FormValue("version")
|
||||
traws := r.FormValue("targets")
|
||||
|
||||
var targets []string
|
||||
if len(traws) > 0 {
|
||||
if err := json.Unmarshal([]byte(traws), &targets); err != nil {
|
||||
logger.Error(err)
|
||||
w.WriteHeader(http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
if len(name) == 0 || len(version) == 0 || len(targets) == 0 {
|
||||
w.WriteHeader(http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
|
||||
h.Operation().Withdraw(MakeWithdrawRequest(
|
||||
shared.WithdrawRequest{
|
||||
Name: name,
|
||||
Version: version,
|
||||
},
|
||||
targets,
|
||||
))
|
||||
}
|
||||
|
||||
func (h *houstonHandler) StartProcess(w http.ResponseWriter, r *http.Request) {
|
||||
// <form action="/houston" method="post" enctype="multipart/form-data">
|
||||
// <input type="text" name="name">
|
||||
|
||||
Reference in New Issue
Block a user