mirror of
https://github.com/kemko/nomad.git
synced 2026-01-04 17:35:43 +03:00
http: list results are never null
This commit is contained in:
@@ -23,6 +23,9 @@ func (s *HTTPServer) AllocsRequest(resp http.ResponseWriter, req *http.Request)
|
||||
}
|
||||
|
||||
setMeta(resp, &out.QueryMeta)
|
||||
if out.Allocations == nil {
|
||||
out.Allocations = make([]*structs.AllocListStub, 0)
|
||||
}
|
||||
return out.Allocations, nil
|
||||
}
|
||||
|
||||
|
||||
@@ -23,6 +23,9 @@ func (s *HTTPServer) EvalsRequest(resp http.ResponseWriter, req *http.Request) (
|
||||
}
|
||||
|
||||
setMeta(resp, &out.QueryMeta)
|
||||
if out.Evaluations == nil {
|
||||
out.Evaluations = make([]*structs.Evaluation, 0)
|
||||
}
|
||||
return out.Evaluations, nil
|
||||
}
|
||||
|
||||
@@ -55,6 +58,9 @@ func (s *HTTPServer) evalAllocations(resp http.ResponseWriter, req *http.Request
|
||||
}
|
||||
|
||||
setMeta(resp, &out.QueryMeta)
|
||||
if out.Allocations == nil {
|
||||
out.Allocations = make([]*structs.AllocListStub, 0)
|
||||
}
|
||||
return out.Allocations, nil
|
||||
}
|
||||
|
||||
|
||||
@@ -30,6 +30,9 @@ func (s *HTTPServer) jobListRequest(resp http.ResponseWriter, req *http.Request)
|
||||
}
|
||||
|
||||
setMeta(resp, &out.QueryMeta)
|
||||
if out.Jobs == nil {
|
||||
out.Jobs = make([]*structs.JobListStub, 0)
|
||||
}
|
||||
return out.Jobs, nil
|
||||
}
|
||||
|
||||
@@ -86,6 +89,9 @@ func (s *HTTPServer) jobAllocations(resp http.ResponseWriter, req *http.Request,
|
||||
}
|
||||
|
||||
setMeta(resp, &out.QueryMeta)
|
||||
if out.Allocations == nil {
|
||||
out.Allocations = make([]*structs.AllocListStub, 0)
|
||||
}
|
||||
return out.Allocations, nil
|
||||
}
|
||||
|
||||
@@ -107,6 +113,9 @@ func (s *HTTPServer) jobEvaluations(resp http.ResponseWriter, req *http.Request,
|
||||
}
|
||||
|
||||
setMeta(resp, &out.QueryMeta)
|
||||
if out.Evaluations == nil {
|
||||
out.Evaluations = make([]*structs.Evaluation, 0)
|
||||
}
|
||||
return out.Evaluations, nil
|
||||
}
|
||||
|
||||
|
||||
@@ -24,6 +24,9 @@ func (s *HTTPServer) NodesRequest(resp http.ResponseWriter, req *http.Request) (
|
||||
}
|
||||
|
||||
setMeta(resp, &out.QueryMeta)
|
||||
if out.Nodes == nil {
|
||||
out.Nodes = make([]*structs.NodeListStub, 0)
|
||||
}
|
||||
return out.Nodes, nil
|
||||
}
|
||||
|
||||
@@ -80,6 +83,9 @@ func (s *HTTPServer) nodeAllocations(resp http.ResponseWriter, req *http.Request
|
||||
}
|
||||
|
||||
setMeta(resp, &out.QueryMeta)
|
||||
if out.Allocs == nil {
|
||||
out.Allocs = make([]*structs.Allocation, 0)
|
||||
}
|
||||
return out.Allocs, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user