mirror of
https://github.com/goharbor/harbor.git
synced 2024-11-02 16:49:48 +01:00
Merge pull request #529 from reasonerjt/master
write log to job log when it's canceled, fixes #527
This commit is contained in:
commit
4edfbeb30b
@ -191,6 +191,7 @@ func (sm *SM) Reset(jid int64) error {
|
||||
sm.desiredState = ""
|
||||
sm.lock.Unlock()
|
||||
|
||||
sm.Logger = utils.NewLogger(sm.JobID)
|
||||
//init parms
|
||||
job, err := dao.GetRepJob(sm.JobID)
|
||||
if err != nil {
|
||||
@ -239,7 +240,6 @@ func (sm *SM) Reset(jid int64) error {
|
||||
sm.Parms.TargetPassword = pwd
|
||||
|
||||
//init states handlers
|
||||
sm.Logger = utils.NewLogger(sm.JobID)
|
||||
sm.Handlers = make(map[string]StateHandler)
|
||||
sm.Transitions = make(map[string]map[string]struct{})
|
||||
sm.CurrentState = models.JobPending
|
||||
|
@ -1,16 +1,16 @@
|
||||
/*
|
||||
Copyright (c) 2016 VMware, Inc. All Rights Reserved.
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
Copyright (c) 2016 VMware, Inc. All Rights Reserved.
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package job
|
||||
@ -90,8 +90,9 @@ func (w *Worker) handleRepJob(id int64) {
|
||||
return
|
||||
}
|
||||
if w.SM.Parms.Enabled == 0 {
|
||||
log.Debugf("The policy of job:%d is disabled, will cancel the job")
|
||||
log.Debugf("The policy of job:%d is disabled, will cancel the job", id)
|
||||
_ = dao.UpdateRepJobStatus(id, models.JobCanceled)
|
||||
w.SM.Logger.Info("The job has been canceled")
|
||||
} else {
|
||||
w.SM.Start(models.JobRunning)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user