etcdctl: cluster health exit with non-zero when cluster is unhealthy

This commit is contained in:
Xiang Li 2015-11-20 13:49:40 -08:00
parent 09b81bad15
commit fc61fc7c7a
2 changed files with 7 additions and 1 deletions

View File

@ -108,8 +108,13 @@ func handleClusterHealth(c *cli.Context) {
}
if !forever {
break
if health {
os.Exit(ExitSuccess)
} else {
os.Exit(ExitClusterNotHealthy)
}
}
fmt.Printf("\nnext check after 10 second...\n\n")
time.Sleep(10 * time.Second)
}

View File

@ -27,6 +27,7 @@ const (
ExitBadConnection
ExitBadAuth
ExitServerError
ExitClusterNotHealthy
)
func handleError(code int, err error) {