diff --git a/.changelog/16892.txt b/.changelog/16892.txt new file mode 100644 index 000000000..35553050d --- /dev/null +++ b/.changelog/16892.txt @@ -0,0 +1,3 @@ +```release-note:improvement +license: show Terminated field in `license get` command +``` diff --git a/command/license.go b/command/license.go index 5863c3ebf..18dc7970a 100644 --- a/command/license.go +++ b/command/license.go @@ -47,20 +47,27 @@ func (l *LicenseCommand) Run(args []string) int { func OutputLicenseReply(ui cli.Ui, resp *api.LicenseReply) int { now := time.Now() expired := resp.License.ExpirationTime.Before(now) - outputLicenseInfo(ui, resp.License, expired) + terminated := resp.License.TerminationTime.Before(now) + outputLicenseInfo(ui, resp.License, expired, terminated) if expired { return 1 } return 0 } -func outputLicenseInfo(ui cli.Ui, lic *api.License, expired bool) { +func outputLicenseInfo(ui cli.Ui, lic *api.License, expired, terminated bool) { expStr := "" if expired { expStr = fmt.Sprintf("Expired At|%s", lic.ExpirationTime.String()) } else { expStr = fmt.Sprintf("Expires At|%s", lic.ExpirationTime.String()) } + termStr := "" + if terminated { + termStr = fmt.Sprintf("Terminated At|%s", lic.TerminationTime.String()) + } else { + termStr = fmt.Sprintf("Terminates At|%s", lic.TerminationTime.String()) + } validity := "valid" if expired { @@ -73,6 +80,7 @@ func outputLicenseInfo(ui cli.Ui, lic *api.License, expired bool) { fmt.Sprintf("Customer ID|%s", lic.CustomerID), fmt.Sprintf("Issued At|%s", lic.IssueTime), expStr, + termStr, fmt.Sprintf("Datacenter|%s", lic.InstallationID), } ui.Output(formatKV(output)) diff --git a/website/content/docs/commands/license/get.mdx b/website/content/docs/commands/license/get.mdx index 5a3f9f368..e890fb74f 100644 --- a/website/content/docs/commands/license/get.mdx +++ b/website/content/docs/commands/license/get.mdx @@ -36,9 +36,8 @@ Product = nomad License Status = valid License ID = e23f63b1-00ec-4e67-e926-c22e7937ceec Customer ID = 350356e5-8aec-bdf4-8510-b205079ccad2 +Issued At = 2021-03-31 14:21:16.969610774 +0000 UTC Expires At = 2020-05-09 00:00:00 +0000 UTC -License ID = e23f63b1-00ec-4e67-e926-c22e7937ceec -Customer ID = 350356e5-8aec-bdf4-8510-b205079ccad2 Terminates At = 2020-05-10 00:00:00 +0000 UTC Datacenter = * Modules: