diff --git a/command/agent/job_endpoint.go b/command/agent/job_endpoint.go index adb8c7558c47..172940a24b45 100644 --- a/command/agent/job_endpoint.go +++ b/command/agent/job_endpoint.go @@ -347,7 +347,7 @@ func (s *HTTPServer) jobActions(resp http.ResponseWriter, req *http.Request, job var out structs.ActionListResponse if err := s.agent.RPC("Job.GetActions", &args, &out); err != nil { - return nil, fmt.Errorf("Oh dang: %w", err) + return nil, err } setMeta(resp, &structs.QueryMeta{}) diff --git a/nomad/job_endpoint.go b/nomad/job_endpoint.go index 7b71d8769fb4..4542ee2b020b 100644 --- a/nomad/job_endpoint.go +++ b/nomad/job_endpoint.go @@ -1758,14 +1758,21 @@ func (j *Job) GetActions(args *structs.JobSpecificRequest, reply *structs.Action } // Get its task groups' tasks' actions - actions := make([]*structs.Action, 0) + jobActions := make([]*structs.JobAction, 0) for _, tg := range job.TaskGroups { for _, task := range tg.Tasks { - actions = append(actions, task.Actions...) + for _, action := range task.Actions { + jobAction := &structs.JobAction{ + Action: *action, + TaskName: task.Name, + TaskGroupName: tg.Name, + } + jobActions = append(jobActions, jobAction) + } } } - // set it on reply - reply.Actions = actions + + reply.Actions = jobActions // set meta j.srv.setQueryMeta(&reply.QueryMeta) diff --git a/nomad/structs/structs.go b/nomad/structs/structs.go index 7173595cf678..b8057b6b08e3 100644 --- a/nomad/structs/structs.go +++ b/nomad/structs/structs.go @@ -13293,13 +13293,12 @@ type Action struct { } type JobAction struct { - Action Action + Action TaskName string TaskGroupName string } -// DeploymentListResponse is used for a list request type ActionListResponse struct { - Actions []*Action + Actions []*JobAction QueryMeta }