Merge pull request #2348 from hashicorp/revert-2339-b-job-delete
Revert "Deregistering non-existant job returns 404"
This commit is contained in:
commit
8ba491f2d7
|
@ -327,11 +327,7 @@ func (s *HTTPServer) jobDelete(resp http.ResponseWriter, req *http.Request,
|
|||
s.parseRegion(req, &args.Region)
|
||||
|
||||
var out structs.JobDeregisterResponse
|
||||
err := s.agent.RPC("Job.Deregister", &args, &out)
|
||||
if err != nil {
|
||||
if strings.HasSuffix(err.Error(), "does not exist") {
|
||||
return nil, CodedError(404, err.Error())
|
||||
}
|
||||
if err := s.agent.RPC("Job.Deregister", &args, &out); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
setIndex(resp, out.Index)
|
||||
|
|
|
@ -389,10 +389,6 @@ func (j *Job) Deregister(args *structs.JobDeregisterRequest, reply *structs.JobD
|
|||
return err
|
||||
}
|
||||
|
||||
if job == nil {
|
||||
return fmt.Errorf("job %q does not exist", args.JobID)
|
||||
}
|
||||
|
||||
// Commit this update via Raft
|
||||
_, index, err := j.srv.raftApply(structs.JobDeregisterRequestType, args)
|
||||
if err != nil {
|
||||
|
|
Loading…
Reference in a new issue