diff --git a/cli/commands.go b/cli/commands.go index 62498cf4d..5e28bb2e4 100644 --- a/cli/commands.go +++ b/cli/commands.go @@ -163,8 +163,8 @@ func Commands(metaPtr *command.Meta) map[string]cli.CommandFactory { }, nil }, - "seal-status": func() (cli.Command, error) { - return &command.SealStatusCommand{ + "status": func() (cli.Command, error) { + return &command.StatusCommand{ Meta: meta, }, nil }, diff --git a/command/seal_status.go b/command/status.go similarity index 78% rename from command/seal_status.go rename to command/status.go index 9f3b76002..b6934fc7e 100644 --- a/command/seal_status.go +++ b/command/status.go @@ -5,14 +5,14 @@ import ( "strings" ) -// SealStatusCommand is a Command that outputs the status of whether -// Vault is sealed or not. -type SealStatusCommand struct { +// StatusCommand is a Command that outputs the status of whether +// Vault is sealed or not as well as HA information. +type StatusCommand struct { Meta } -func (c *SealStatusCommand) Run(args []string) int { - flags := c.Meta.FlagSet("seal-status", FlagSetDefault) +func (c *StatusCommand) Run(args []string) int { + flags := c.Meta.FlagSet("status", FlagSetDefault) flags.Usage = func() { c.Ui.Error(c.Help()) } if err := flags.Parse(args); err != nil { return 1 @@ -63,15 +63,15 @@ func (c *SealStatusCommand) Run(args []string) int { } } -func (c *SealStatusCommand) Synopsis() string { - return "Outputs status of whether Vault is sealed" +func (c *StatusCommand) Synopsis() string { + return "Outputs status of whether Vault is sealed and if HA mode is enabled" } -func (c *SealStatusCommand) Help() string { +func (c *StatusCommand) Help() string { helpText := ` -Usage: vault seal-status [options] +Usage: vault status [options] - Outputs the state of the Vault, sealed or unsealed. + Outputs the state of the Vault, sealed or unsealed and if HA is enabled. This command outputs whether or not the Vault is sealed. The exit code also reflects the seal status (0 unsealed, 1 sealed, 2+ error). diff --git a/command/seal_status_test.go b/command/status_test.go similarity index 91% rename from command/seal_status_test.go rename to command/status_test.go index 4f509c495..eb93dffa8 100644 --- a/command/seal_status_test.go +++ b/command/status_test.go @@ -8,9 +8,9 @@ import ( "github.com/mitchellh/cli" ) -func TestSealStatus(t *testing.T) { +func TestStatus(t *testing.T) { ui := new(cli.MockUi) - c := &SealStatusCommand{ + c := &StatusCommand{ Meta: Meta{ Ui: ui, },