Skip to content

Commit

Permalink
cli: remove deprecated eval status -json list behavior
Browse files Browse the repository at this point in the history
In Nomad 1.2.6 we shipped `eval list`, which accepts a `-json` flag, and
deprecated the usage of `eval status` without an evaluation ID with an upgrade
note that it would be removed in Nomad 1.4.0. This changeset completes that
work.
  • Loading branch information
tgross committed Sep 22, 2022
1 parent 349501f commit a1903aa
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 19 deletions.
3 changes: 3 additions & 0 deletions .changelog/14651.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:deprecation
cli: `eval status -json` no longer supports listing all evals in JSON. Use `eval list -json`.
```
23 changes: 5 additions & 18 deletions command/eval_status.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,24 +105,6 @@ func (c *EvalStatusCommand) Run(args []string) int {
return 1
}

// If args not specified but output format is specified, format and output the evaluations data list
if len(args) == 0 && (json || len(tmpl) > 0) {
evals, _, err := client.Evaluations().List(nil)
if err != nil {
c.Ui.Error(fmt.Sprintf("Error querying evaluations: %v", err))
return 1
}

out, err := Format(json, tmpl, evals)
if err != nil {
c.Ui.Error(err.Error())
return 1
}

c.Ui.Output(out)
return 0
}

if len(args) != 1 {
c.Ui.Error("This command takes one argument")
c.Ui.Error(commandErrorText(c))
Expand All @@ -143,6 +125,11 @@ func (c *EvalStatusCommand) Run(args []string) int {
return 1
}

if json && len(tmpl) > 0 {
c.Ui.Error("Both json and template formatting are not allowed")
return 1
}

evalID = sanitizeUUIDPrefix(evalID)
evals, _, err := client.Evaluations().PrefixList(evalID)
if err != nil {
Expand Down
3 changes: 2 additions & 1 deletion command/eval_status_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ func TestEvalStatusCommand_Fails(t *testing.T) {
ui.ErrorWriter.Reset()

// Failed on both -json and -t options are specified
if code := cmd.Run([]string{"-address=" + url, "-json", "-t", "{{.ID}}"}); code != 1 {
if code := cmd.Run([]string{"-address=" + url, "-json", "-t", "{{.ID}}",
"12345678-abcd-efab-cdef-123456789abc"}); code != 1 {
t.Fatalf("expected exit 1, got: %d", code)
}
if out := ui.ErrorWriter.String(); !strings.Contains(out, "Both json and template formatting are not allowed") {
Expand Down
9 changes: 9 additions & 0 deletions website/content/docs/upgrade/upgrade-specific.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,15 @@ behavior to reserve for a major Nomad release and *not* be backported. Please
report any negative side effects encountered as [new
issues.][gh_issue]

#### `nomad eval status -json` Without Evaluation ID Removed

Using `nomad eval status -json` without providing an evaluation ID was
deprecated in Nomad 1.2.4 with the intent to remove in Nomad 1.4.0. This option
has been removed. You can use `nomad eval list` to get a list of evaluations and
can use `nomad eval list -json` to get that list in JSON format. The `nomad eval
status <eval ID>` command will format a specific evaluation in JSON format if
the `-json` flag is provided.

## Nomad 1.3.3

Environments that don't support the use of [`uid`][template_uid] and
Expand Down

0 comments on commit a1903aa

Please sign in to comment.