[1.2] 리플레이
- 리플레이 파일 이름 유지하도록 수정
This commit is contained in:
@ -34,9 +34,9 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type runcommand struct {
|
type runcommand struct {
|
||||||
Exec string `json:"exec"`
|
Exec string `json:"exec"`
|
||||||
Args []string `json:"args"`
|
Args []string `json:"args"`
|
||||||
Version string `json:"version"`
|
Version string `json:"version"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type clientConfig struct {
|
type clientConfig struct {
|
||||||
@ -98,9 +98,10 @@ func (pm *procmeta) setState(s protos.ProcessState) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type uploadRequest struct {
|
type uploadRequest struct {
|
||||||
filePath string
|
filePath string
|
||||||
name string
|
name string
|
||||||
version string
|
version string
|
||||||
|
uploadedFileName string
|
||||||
}
|
}
|
||||||
|
|
||||||
type houstonClient struct {
|
type houstonClient struct {
|
||||||
@ -503,7 +504,7 @@ func NewClient(standalone bool) (HoustonClient, error) {
|
|||||||
return hc, nil
|
return hc, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func uploadSafe(url, filePath, name, version string) error {
|
func uploadSafe(url, filePath, name, version, uploadedFileName string) error {
|
||||||
defer func() {
|
defer func() {
|
||||||
r := recover()
|
r := recover()
|
||||||
if r != nil {
|
if r != nil {
|
||||||
@ -537,7 +538,10 @@ func uploadSafe(url, filePath, name, version string) error {
|
|||||||
// createTime := file.
|
// createTime := file.
|
||||||
httpreq.Header.Set("Houston-Service-Name", name)
|
httpreq.Header.Set("Houston-Service-Name", name)
|
||||||
httpreq.Header.Set("Houston-Service-Version", version)
|
httpreq.Header.Set("Houston-Service-Version", version)
|
||||||
httpreq.Header.Set("Houston-Service-Filename", t.BirthTime().UTC().Format(time.DateOnly)+"."+hn+path.Ext(filePath))
|
if len(uploadedFileName) == 0 {
|
||||||
|
uploadedFileName = t.BirthTime().UTC().Format(time.DateOnly) + "." + hn + path.Ext(filePath)
|
||||||
|
}
|
||||||
|
httpreq.Header.Set("Houston-Service-Filename", uploadedFileName)
|
||||||
httpreq.Header.Set("Content-Type", "application/zip")
|
httpreq.Header.Set("Content-Type", "application/zip")
|
||||||
resp, err := http.DefaultClient.Do(httpreq)
|
resp, err := http.DefaultClient.Do(httpreq)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -581,7 +585,7 @@ func (hc *houstonClient) Start() {
|
|||||||
url := hc.config.HttpAddress + "/upload"
|
url := hc.config.HttpAddress + "/upload"
|
||||||
for req := range hc.uploadChan {
|
for req := range hc.uploadChan {
|
||||||
logger.Println("uploadSafe :", req)
|
logger.Println("uploadSafe :", req)
|
||||||
err := uploadSafe(url, req.filePath, req.name, req.version)
|
err := uploadSafe(url, req.filePath, req.name, req.version, req.uploadedFileName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Println("uploadSafe return err :", err)
|
logger.Println("uploadSafe return err :", err)
|
||||||
}
|
}
|
||||||
@ -630,8 +634,8 @@ func (hc *houstonClient) Start() {
|
|||||||
logger.Println("autorun success :", sr)
|
logger.Println("autorun success :", sr)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
|
|||||||
@ -8,6 +8,7 @@ import (
|
|||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
"errors"
|
"errors"
|
||||||
"os"
|
"os"
|
||||||
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -129,7 +130,7 @@ func handleStdOutUploadRequest(hc *houstonClient, meta *procmeta, param string)
|
|||||||
if _, err := os.Stat(uploadFullPath); err != nil {
|
if _, err := os.Stat(uploadFullPath); err != nil {
|
||||||
return err
|
return err
|
||||||
} else {
|
} else {
|
||||||
hc.uploadToAppendFile(uploadFullPath, meta.name, meta.version)
|
hc.uploadToAppendFile(uploadFullPath, meta.name, meta.version, filepath.Base(uploadFullPath))
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
@ -44,11 +44,12 @@ func lastExecutionArgs(verpath string) []string {
|
|||||||
return out
|
return out
|
||||||
}
|
}
|
||||||
|
|
||||||
func (hc *houstonClient) uploadToAppendFile(filePath string, name string, version string) {
|
func (hc *houstonClient) uploadToAppendFile(filePath string, name string, version string, uploadedFileName string) {
|
||||||
hc.uploadChan <- uploadRequest{
|
hc.uploadChan <- uploadRequest{
|
||||||
filePath: filePath,
|
filePath: filePath,
|
||||||
name: name,
|
name: name,
|
||||||
version: version,
|
version: version,
|
||||||
|
uploadedFileName: uploadedFileName,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user