Merge pull request #2348 from hashicorp/revert-2339-b-job-delete

Revert "Deregistering non-existant job returns 404"
This commit is contained in:
Alex Dadgar 2017-02-22 18:22:14 -08:00 committed by GitHub
commit 8ba491f2d7
2 changed files with 1 additions and 9 deletions

View file

@ -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)

View file

@ -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 {