cli: fix panic on job plan when -diff=false (#16944)
PR #14492 introduced a new check to return 0 when the `nomad job plan` command returns a diff of type `None`. But the `-diff` CLI flag was also being used to control whether the plan request should return the diff of not instead of just controlling if the diff was printed. This means that when `-diff=false` is set the response does not include any diff information, and so the new check panics. This commit fixes the problem by always requesting a diff and using the `-diff` only for controlling output, as it's currently documented.
This commit is contained in:
parent
b5a54b3b5f
commit
a1ba068e1f
|
@ -0,0 +1,3 @@
|
||||||
|
```release-note:bug
|
||||||
|
cli: Fix panic on job plan when -diff=false
|
||||||
|
```
|
|
@ -237,9 +237,9 @@ func (c *JobPlanCommand) Run(args []string) int {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Setup the options
|
// Setup the options
|
||||||
opts := &api.PlanOptions{}
|
opts := &api.PlanOptions{
|
||||||
if diff {
|
// Always request the diff so we can tell if there are changes.
|
||||||
opts.Diff = true
|
Diff: true,
|
||||||
}
|
}
|
||||||
if policyOverride {
|
if policyOverride {
|
||||||
opts.PolicyOverride = true
|
opts.PolicyOverride = true
|
||||||
|
|
Loading…
Reference in New Issue