mirror of
https://github.com/kemko/nomad.git
synced 2026-01-08 03:15:42 +03:00
license: update 'license get' command
This commit is contained in:
@@ -15,19 +15,13 @@ func (c *LicenseGetCommand) Help() string {
|
||||
helpText := `
|
||||
Usage: nomad license get [options]
|
||||
|
||||
Gets a new license in Servers and Clients
|
||||
Gets the license loaded by the server. The command is not forwarded to the
|
||||
Nomad leader, and will return the license from the specific server being
|
||||
contacted.
|
||||
|
||||
When ACLs are enabled, this command requires a token with the
|
||||
'operator:read' capability.
|
||||
|
||||
-stale=[true|false]
|
||||
By default the license get command will be forwarded to the Nomad leader.
|
||||
If -stale is set to true, the command will not be forwarded to the
|
||||
leader and will return the license from the specific server being
|
||||
contacted. This option may be useful during upgrade scenarios when a server
|
||||
is given a new file license and is a follower so the new license has not
|
||||
yet been propagated to raft.
|
||||
|
||||
General Options:
|
||||
|
||||
` + generalOptionsUsage(usageOptsDefault|usageOptsNoNamespace)
|
||||
@@ -36,10 +30,7 @@ General Options:
|
||||
}
|
||||
|
||||
func (c *LicenseGetCommand) AutocompleteFlags() complete.Flags {
|
||||
return mergeAutocompleteFlags(c.Meta.AutocompleteFlags(FlagSetClient),
|
||||
complete.Flags{
|
||||
"-stale": complete.PredictAnything,
|
||||
})
|
||||
return complete.Flags{}
|
||||
}
|
||||
|
||||
func (c *LicenseGetCommand) AutocompleteArgs() complete.Predictor {
|
||||
@@ -53,13 +44,9 @@ func (c *LicenseGetCommand) Synopsis() string {
|
||||
func (c *LicenseGetCommand) Name() string { return "license get" }
|
||||
|
||||
func (c *LicenseGetCommand) Run(args []string) int {
|
||||
var stale bool
|
||||
|
||||
flags := c.Meta.FlagSet(c.Name(), FlagSetClient)
|
||||
flags.Usage = func() { c.Ui.Output(c.Help()) }
|
||||
|
||||
flags.BoolVar(&stale, "stale", false, "")
|
||||
|
||||
if err := flags.Parse(args); err != nil {
|
||||
c.Ui.Error(fmt.Sprintf("Error parsing flags: %s", err))
|
||||
return 1
|
||||
@@ -71,10 +58,7 @@ func (c *LicenseGetCommand) Run(args []string) int {
|
||||
return 1
|
||||
}
|
||||
|
||||
q := &api.QueryOptions{
|
||||
AllowStale: stale,
|
||||
}
|
||||
resp, _, err := client.Operator().LicenseGet(q)
|
||||
resp, _, err := client.Operator().LicenseGet(&api.QueryOptions{})
|
||||
if err != nil {
|
||||
c.Ui.Error(fmt.Sprintf("Error getting license: %v", err))
|
||||
return 1
|
||||
|
||||
Reference in New Issue
Block a user