From faa07cc1659cf250ce651095c8dce7b6ced97cbb Mon Sep 17 00:00:00 2001 From: Ian Unruh Date: Tue, 19 May 2015 00:34:18 -0700 Subject: [PATCH] Improve unseal CLI message --- command/unseal.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/command/unseal.go b/command/unseal.go index f7d7aceb5..18d486f45 100644 --- a/command/unseal.go +++ b/command/unseal.go @@ -33,6 +33,18 @@ func (c *UnsealCommand) Run(args []string) int { return 2 } + sealStatus, err := client.Sys().SealStatus() + if err != nil { + c.Ui.Error(fmt.Sprintf( + "Error checking seal status: %s", err)) + return 2 + } + + if !sealStatus.Sealed { + c.Ui.Output("Vault is already unsealed.") + return 0 + } + args = flags.Args() value := c.Key