Skip to content

Commit

Permalink
Merge pull request #9296 from hashicorp/b-remove-namespace-from-scale…
Browse files Browse the repository at this point in the history
…-request

Remove Namespace field from JobScaleRequest
  • Loading branch information
lgfa29 committed Nov 9, 2020
2 parents 3854916 + b9991a3 commit 6881346
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
2 changes: 0 additions & 2 deletions command/agent/job_endpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -495,15 +495,13 @@ func (s *HTTPServer) jobScaleAction(resp http.ResponseWriter, req *http.Request,
return nil, CodedError(400, err.Error())
}

namespace := args.Target[structs.ScalingTargetNamespace]
targetJob := args.Target[structs.ScalingTargetJob]
if targetJob != "" && targetJob != jobName {
return nil, CodedError(400, "job ID in payload did not match URL")
}

scaleReq := structs.JobScaleRequest{
JobID: jobName,
Namespace: namespace,
Target: args.Target,
Count: args.Count,
PolicyOverride: args.PolicyOverride,
Expand Down
13 changes: 6 additions & 7 deletions nomad/structs/structs.go
Original file line number Diff line number Diff line change
Expand Up @@ -693,13 +693,12 @@ type JobPlanRequest struct {
// JobScaleRequest is used for the Job.Scale endpoint to scale one of the
// scaling targets in a job
type JobScaleRequest struct {
Namespace string
JobID string
Target map[string]string
Count *int64
Message string
Error bool
Meta map[string]interface{}
JobID string
Target map[string]string
Count *int64
Message string
Error bool
Meta map[string]interface{}
// PolicyOverride is set when the user is attempting to override any policies
PolicyOverride bool
WriteRequest
Expand Down

0 comments on commit 6881346

Please sign in to comment.