mirror of
https://github.com/goharbor/harbor.git
synced 2024-11-24 03:05:39 +01:00
Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
ea366357e9
@ -191,6 +191,7 @@ func (sm *SM) Reset(jid int64) error {
|
|||||||
sm.desiredState = ""
|
sm.desiredState = ""
|
||||||
sm.lock.Unlock()
|
sm.lock.Unlock()
|
||||||
|
|
||||||
|
sm.Logger = utils.NewLogger(sm.JobID)
|
||||||
//init parms
|
//init parms
|
||||||
job, err := dao.GetRepJob(sm.JobID)
|
job, err := dao.GetRepJob(sm.JobID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -239,7 +240,6 @@ func (sm *SM) Reset(jid int64) error {
|
|||||||
sm.Parms.TargetPassword = pwd
|
sm.Parms.TargetPassword = pwd
|
||||||
|
|
||||||
//init states handlers
|
//init states handlers
|
||||||
sm.Logger = utils.NewLogger(sm.JobID)
|
|
||||||
sm.Handlers = make(map[string]StateHandler)
|
sm.Handlers = make(map[string]StateHandler)
|
||||||
sm.Transitions = make(map[string]map[string]struct{})
|
sm.Transitions = make(map[string]map[string]struct{})
|
||||||
sm.CurrentState = models.JobPending
|
sm.CurrentState = models.JobPending
|
||||||
|
@ -90,8 +90,9 @@ func (w *Worker) handleRepJob(id int64) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
if w.SM.Parms.Enabled == 0 {
|
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)
|
_ = dao.UpdateRepJobStatus(id, models.JobCanceled)
|
||||||
|
w.SM.Logger.Info("The job has been canceled")
|
||||||
} else {
|
} else {
|
||||||
w.SM.Start(models.JobRunning)
|
w.SM.Start(models.JobRunning)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user