Merge branch 'master' of https://github.com/goodrain/rainbond into for_install_3.4.1

This commit is contained in:
Bay 2018-01-03 19:12:36 +08:00
commit e8c2f8ff88
3 changed files with 12 additions and 7 deletions

View File

@ -36,7 +36,6 @@ import (
tutil "github.com/goodrain/rainbond/pkg/util"
httputil "github.com/goodrain/rainbond/pkg/util/http"
validator "github.com/thedevsaddam/govalidator"
)
//TIMELAYOUT timelayout
@ -345,6 +344,12 @@ func (t *TenantStruct) RestartService(w http.ResponseWriter, r *http.Request) {
EventID: eventID,
TaskType: "restart",
}
curStatus, err := db.GetManager().TenantServiceStatusDao().GetTenantServiceStatus(serviceID)
if err == nil {
if curStatus.Status == "closed" {
startStopStruct.TaskType = "start"
}
}
if err := handler.GetServiceManager().StartStopService(startStopStruct); err != nil {
logger.Error("应用重启任务发送失败 "+err.Error(), map[string]string{"step": "callback", "status": "failure"})
httputil.ReturnError(r, w, 500, "get service info error.")
@ -511,7 +516,6 @@ func (t *TenantStruct) BuildService(w http.ResponseWriter, r *http.Request) {
version.Kind = build.Body.Kind
version.BuildVersion = build.Body.DeployVersion
build.Body.EventID = sEvent.EventID
if err := handler.GetServiceManager().ServiceBuild(tenantID, serviceID, &build); err != nil {
logrus.Debugf("build service error")
@ -520,10 +524,10 @@ func (t *TenantStruct) BuildService(w http.ResponseWriter, r *http.Request) {
}
logrus.Debugf("equeue mq build task success")
err=db.GetManager().VersionInfoDao().AddModel(&version)
err = db.GetManager().VersionInfoDao().AddModel(&version)
if err != nil {
logrus.Infof("error add version %v ,details %s",version,err.Error())
logrus.Infof("error add version %v ,details %s", version, err.Error())
}
logrus.Debugf("equeue mq build task success")
httputil.ReturnSuccess(r, w, sEvent)

View File

@ -372,7 +372,7 @@ func (s *ServiceAction) StartStopService(sss *api_model.StartStopStruct) error {
}
eq, errEq := api_db.BuildTask(ts)
if errEq != nil {
logrus.Errorf("build equeue stop request error, %v", errEq)
logrus.Errorf("build equeue startstop request error, %v", errEq)
return errEq
}
_, err = s.MQClient.Enqueue(context.Background(), eq)
@ -380,7 +380,7 @@ func (s *ServiceAction) StartStopService(sss *api_model.StartStopStruct) error {
logrus.Errorf("equque mq error, %v", err)
return err
}
logrus.Debugf("equeue mq stop task success")
logrus.Debugf("equeue mq startstop task success")
return nil
}

View File

@ -19,7 +19,8 @@ VERSION=$(git branch | grep '^*' | cut -d ' ' -f 2 | tr '-' " " | awk '{print $2
git_commit=$(git log -n 1 --pretty --format=%h)
if [ $describe_len -ge 3 ];then
buildRelease=${describe_items[-2]}.${describe_items[-1]}
#buildRelease=${describe_items[-2]}.${describe_items[-1]}
buildRelease=${describe_items[*]: -2:1}.${describe_items[*]: -1}
else
buildRelease=0.$git_commit
fi