mirror of
https://github.com/hashicorp/vault.git
synced 2026-06-13 19:00:44 -04:00
command: Adding HA status
This commit is contained in:
parent
17ba500f18
commit
da490b3bd7
1 changed files with 20 additions and 7 deletions
|
|
@ -25,25 +25,38 @@ func (c *SealStatusCommand) Run(args []string) int {
|
|||
return 2
|
||||
}
|
||||
|
||||
status, err := client.Sys().SealStatus()
|
||||
sealStatus, err := client.Sys().SealStatus()
|
||||
if err != nil {
|
||||
c.Ui.Error(fmt.Sprintf(
|
||||
"Error checking seal status: %s", err))
|
||||
return 2
|
||||
}
|
||||
|
||||
leaderStatus, err := client.Sys().Leader()
|
||||
if err != nil {
|
||||
c.Ui.Error(fmt.Sprintf(
|
||||
"Error checking leader status: %s", err))
|
||||
return 2
|
||||
}
|
||||
|
||||
c.Ui.Output(fmt.Sprintf(
|
||||
"Sealed: %v\n"+
|
||||
"Key Shares: %d\n"+
|
||||
"Key Threshold: %d\n"+
|
||||
"Unseal Progress: %d",
|
||||
status.Sealed,
|
||||
status.N,
|
||||
status.T,
|
||||
status.Progress,
|
||||
"Unseal Progress: %d\n"+
|
||||
"HA Enabled: %v\n"+
|
||||
"Is Leader: %v\n"+
|
||||
"Leader Address: %s",
|
||||
sealStatus.Sealed,
|
||||
sealStatus.N,
|
||||
sealStatus.T,
|
||||
sealStatus.Progress,
|
||||
leaderStatus.HAEnabled,
|
||||
leaderStatus.IsSelf,
|
||||
leaderStatus.LeaderAddress,
|
||||
))
|
||||
|
||||
if status.Sealed {
|
||||
if sealStatus.Sealed {
|
||||
return 1
|
||||
} else {
|
||||
return 0
|
||||
|
|
|
|||
Loading…
Reference in a new issue