command/status: improve output when sealed

This commit is contained in:
Armon Dadgar 2015-04-20 12:21:35 -07:00
parent 52f8b2d8ef
commit 2609977683
1 changed files with 8 additions and 5 deletions

View File

@ -43,6 +43,9 @@ func (c *StatusCommand) Run(args []string) int {
if sealStatus.Sealed {
isLeader = "unknown while sealed"
leaderAddress = "unknown while sealed"
} else if !leaderStatus.HAEnabled {
isLeader = "n/a"
leaderAddress = "n/a"
} else {
isLeader = fmt.Sprintf("%v", leaderStatus.IsSelf)
leaderAddress = leaderStatus.LeaderAddress
@ -50,12 +53,12 @@ func (c *StatusCommand) Run(args []string) int {
c.Ui.Output(fmt.Sprintf(
"Sealed: %v\n"+
"Key Shares: %d\n"+
"Key Threshold: %d\n"+
"Unseal Progress: %d\n"+
"\tKey Shares: %d\n"+
"\tKey Threshold: %d\n"+
"\tUnseal Progress: %d\n"+
"HA Enabled: %v\n"+
"Is Leader: %s\n"+
"Leader Address: %s",
"\tIs Leader: %s\n"+
"\tLeader Address: %s",
sealStatus.Sealed,
sealStatus.N,
sealStatus.T,