셀프 업데이트 작업 추가 by script
This commit is contained in:
@ -25,6 +25,10 @@ import (
|
||||
"golang.org/x/text/transform"
|
||||
)
|
||||
|
||||
const (
|
||||
houston_update_dir = "./houston.update"
|
||||
)
|
||||
|
||||
func pof2(x int64, min int64) (out int64) {
|
||||
out = 1
|
||||
org := x
|
||||
@ -217,13 +221,7 @@ func (hc *houstonClient) prepareDeploy(name string, version string) (destPath st
|
||||
}()
|
||||
|
||||
verpath := path.Join(hc.config.StorageRoot, name, version)
|
||||
if _, err := os.Stat(verpath); os.IsNotExist(err) {
|
||||
// 없네? 만들면 된다.
|
||||
err = os.MkdirAll(verpath, 0775)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
} else {
|
||||
if _, err := os.Stat(verpath); !os.IsNotExist(err) {
|
||||
// 있네? 재배포 가능한가?
|
||||
for _, child := range hc.childProcs {
|
||||
if child.version == version && child.name == name {
|
||||
@ -287,8 +285,10 @@ func (hc *houstonClient) deploy(req *shared.DeployRequest, cb func(*protos.Deplo
|
||||
|
||||
var root string
|
||||
if req.Name == "houston" {
|
||||
// houston은 버전없이 houston.update폴더로 다운로드
|
||||
root = "./houston.update"
|
||||
// houston은 버전없이 houston_update_dir폴더로 다운로드
|
||||
root = houston_update_dir
|
||||
// 이미 houston_update_dir가 있을 수도 있으므로 폴더채로 삭제
|
||||
os.RemoveAll(houston_update_dir)
|
||||
} else {
|
||||
root, err = hc.prepareDeploy(req.Name, req.Version)
|
||||
if err != nil {
|
||||
@ -296,6 +296,11 @@ func (hc *houstonClient) deploy(req *shared.DeployRequest, cb func(*protos.Deplo
|
||||
}
|
||||
}
|
||||
|
||||
err = os.MkdirAll(root, 0775)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// verpath에 배포 시작
|
||||
h := md5.New()
|
||||
h.Write([]byte(strings.Trim(req.Url, "/")))
|
||||
|
||||
Reference in New Issue
Block a user