mirror of
https://github.com/kemko/nomad.git
synced 2026-01-01 16:05:42 +03:00
job summary query in Job.List RPC should use job's namespace (#12249)
The `Job.List` RPC attaches a `JobSummary` to each job stub. We're using the request namespace and not the job namespace for that query, which results in a nil `JobSummary` whenever we pass the wildcard namespace. This is incorrect and causes panics in downstream consumers like the CLI, which assume the `JobSummary` is non-nil as an unstate invariant.
This commit is contained in:
@@ -1412,8 +1412,8 @@ func (j *Job) List(args *structs.JobListRequest, reply *structs.JobListResponse)
|
||||
paginator, err := paginator.NewPaginator(iter, tokenizer, filters, args.QueryOptions,
|
||||
func(raw interface{}) error {
|
||||
job := raw.(*structs.Job)
|
||||
summary, err := state.JobSummaryByID(ws, namespace, job.ID)
|
||||
if err != nil {
|
||||
summary, err := state.JobSummaryByID(ws, job.Namespace, job.ID)
|
||||
if err != nil || summary == nil {
|
||||
return fmt.Errorf("unable to look up summary for job: %v", job.ID)
|
||||
}
|
||||
jobs = append(jobs, job.Stub(summary))
|
||||
|
||||
Reference in New Issue
Block a user