Skip to content

Commit

Permalink
Fix logic inversion in force rescheduling
Browse files Browse the repository at this point in the history
  • Loading branch information
preetapan committed May 9, 2018
1 parent 242cc19 commit 3b7d23f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion nomad/job_endpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -546,6 +546,7 @@ func (j *Job) Evaluate(args *structs.JobEvaluateRequest, reply *structs.JobRegis
}

forceRescheduleAllocs := make(map[string]*structs.DesiredTransition)

if args.EvalOptions.ForceReschedule {
// Find any failed allocs that could be force rescheduled
allocs, err := snap.AllocsByJob(ws, args.RequestNamespace(), args.JobID, false)
Expand All @@ -556,7 +557,7 @@ func (j *Job) Evaluate(args *structs.JobEvaluateRequest, reply *structs.JobRegis
for _, alloc := range allocs {
taskGroup := job.LookupTaskGroup(alloc.TaskGroup)
// Forcing rescheduling is only allowed if task group has rescheduling enabled
if taskGroup != nil && taskGroup.ReschedulePolicy != nil && taskGroup.ReschedulePolicy.Enabled() {
if taskGroup == nil || taskGroup.ReschedulePolicy == nil || !taskGroup.ReschedulePolicy.Enabled() {

This comment has been minimized.

Copy link
@shantanugadgil

shantanugadgil May 9, 2018

Contributor

mixing multiple || and ! ... : cringe : 😖
(not a Gopher yet myself, its just not my personal style 😄 )

continue
}

Expand Down

0 comments on commit 3b7d23f

Please sign in to comment.