etcdctl: cluster health exit with non-zero when cluster is unhealthy
@@ -122,8 +122,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)
@@ -27,6 +27,7 @@ const (
ExitBadConnection
ExitBadAuth
ExitServerError
+ ExitClusterNotHealthy
)
func handleError(code int, err error) {