fix
This commit is contained in:
parent
6a60105ce8
commit
c8dab68524
|
@ -28,31 +28,36 @@ func SyncTaskInfo() {
|
||||||
}
|
}
|
||||||
var sys = new(base.OperateStruct)
|
var sys = new(base.OperateStruct)
|
||||||
now := time.Now()
|
now := time.Now()
|
||||||
|
sync := false
|
||||||
if resp.CloudInfoList != nil && len(resp.CloudInfoList) != 0 {
|
if resp.CloudInfoList != nil && len(resp.CloudInfoList) != 0 {
|
||||||
for _, cloudInfoList := range resp.CloudInfoList {
|
for _, cloudInfoList := range resp.CloudInfoList {
|
||||||
if cloudInfoList.Status == "Pending" {
|
if cloudInfoList.Status == "Saved" {
|
||||||
cloudInfoList.StartTime = &now
|
cloudInfoList.StartTime = &now
|
||||||
sys.YamlString = cloudInfoList.YamlString
|
sys.YamlString = cloudInfoList.YamlString
|
||||||
sys.ClusterName = cloudInfoList.ClusterName
|
sys.ClusterName = cloudInfoList.ClusterName
|
||||||
err = sys.Apply()
|
err = sys.Apply()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
sync = false
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
cloudInfoList.Status = "Running"
|
cloudInfoList.Status = "Running"
|
||||||
// push submitted mark to coordinator
|
sync = true
|
||||||
pushTaskInfo(resp, err, httpClient)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// push submitted mark to coordinator
|
||||||
|
if sync {
|
||||||
|
pushTaskInfo(resp, httpClient)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func pushTaskInfo(resp coreClient.PullTaskInfoResp, err error, httpClient *resty.Request) {
|
func pushTaskInfo(resp coreClient.PullTaskInfoResp, httpClient *resty.Request) {
|
||||||
PushReq := coreClient.PushTaskInfoReq{
|
PushReq := coreClient.PushTaskInfoReq{
|
||||||
AdapterId: global.PCM_CONFIG.System.AdapterId,
|
AdapterId: global.PCM_CONFIG.System.AdapterId,
|
||||||
CloudInfoList: resp.CloudInfoList,
|
CloudInfoList: resp.CloudInfoList,
|
||||||
}
|
}
|
||||||
pushResult := coreClient.PushTaskInfoResp{}
|
pushResult := coreClient.PushTaskInfoResp{}
|
||||||
_, err = httpClient.SetHeader("Content-Type", "application/json").
|
_, err := httpClient.SetHeader("Content-Type", "application/json").
|
||||||
SetBody(&PushReq).
|
SetBody(&PushReq).
|
||||||
SetResult(&pushResult).
|
SetResult(&pushResult).
|
||||||
Post(global.PCM_CONFIG.System.CoreServerUrl + "/pcm/v1/core/pushTaskInfo")
|
Post(global.PCM_CONFIG.System.CoreServerUrl + "/pcm/v1/core/pushTaskInfo")
|
||||||
|
|
Loading…
Reference in New Issue