mirror of
https://github.com/kemko/nomad.git
synced 2026-01-01 16:05:42 +03:00
cli: fix -t flag on job status command (#24054)
In #18925 we added a `-json` flag to the `job status` command, but the argument handling had a bug where it would always set the `-json` flag if either the `-t` or `-json` flags were set, resulting in a misleading error. Instead, pass the `-json` flag value into the formatter. Fixes: https://github.com/hashicorp/nomad/issues/24050
This commit is contained in:
3
.changelog/24054.txt
Normal file
3
.changelog/24054.txt
Normal file
@@ -0,0 +1,3 @@
|
||||
```release-note:bug
|
||||
cli: Fixed a bug in job status command where -t would act as though -json was also set
|
||||
```
|
||||
@@ -173,7 +173,7 @@ func (c *JobStatusCommand) Run(args []string) int {
|
||||
return 1
|
||||
}
|
||||
|
||||
out, err := Format(true, c.tmpl, jsonJobs)
|
||||
out, err := Format(c.json, c.tmpl, jsonJobs)
|
||||
if err != nil {
|
||||
c.Ui.Error(err.Error())
|
||||
return 1
|
||||
@@ -220,7 +220,7 @@ func (c *JobStatusCommand) Run(args []string) int {
|
||||
return 1
|
||||
}
|
||||
|
||||
out, err := Format(true, c.tmpl, jsonJobs)
|
||||
out, err := Format(c.json, c.tmpl, jsonJobs)
|
||||
if err != nil {
|
||||
c.Ui.Error(err.Error())
|
||||
return 1
|
||||
|
||||
Reference in New Issue
Block a user