cli: remove deprecated eval status -json list behavior (#14651)

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.
This commit is contained in:
Tim Gross
2022-09-22 10:56:32 -04:00
committed by GitHub
parent 7a8b1368b7
commit d1e90a17d6
4 changed files with 19 additions and 19 deletions

3
.changelog/14651.txt Normal file
View File

@@ -0,0 +1,3 @@
```release-note:deprecation
cli: `eval status -json` no longer supports listing all evals in JSON. Use `eval list -json`.
```

View File

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

View File

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

View File

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