mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
etcdctl: cluster health exit with non-zero when cluster is unhealthy
This commit is contained in:
parent
82b83cad43
commit
e39206e084
@ -122,8 +122,13 @@ func handleClusterHealth(c *cli.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if !forever {
|
if !forever {
|
||||||
break
|
if health {
|
||||||
|
os.Exit(ExitSuccess)
|
||||||
|
} else {
|
||||||
|
os.Exit(ExitClusterNotHealthy)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Printf("\nnext check after 10 second...\n\n")
|
fmt.Printf("\nnext check after 10 second...\n\n")
|
||||||
time.Sleep(10 * time.Second)
|
time.Sleep(10 * time.Second)
|
||||||
}
|
}
|
||||||
|
@ -27,6 +27,7 @@ const (
|
|||||||
ExitBadConnection
|
ExitBadConnection
|
||||||
ExitBadAuth
|
ExitBadAuth
|
||||||
ExitServerError
|
ExitServerError
|
||||||
|
ExitClusterNotHealthy
|
||||||
)
|
)
|
||||||
|
|
||||||
func handleError(code int, err error) {
|
func handleError(code int, err error) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user