From a98fff84e74d389ebf09d2029a1aa74d4bbe71e8 Mon Sep 17 00:00:00 2001 From: Yicheng Qin Date: Wed, 13 May 2015 17:33:12 -0700 Subject: [PATCH] etcdctl/cluster_health: improve output if failed to get leader stats When failing to get leader stats, it said 'cluster is unhealthy' before. This is confusing when it cannot get stats because advertised client urls are set wrong and the cluster is healthy. --- etcdctl/command/cluster_health.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/etcdctl/command/cluster_health.go b/etcdctl/command/cluster_health.go index 5a80e7e12..fb94afb90 100644 --- a/etcdctl/command/cluster_health.go +++ b/etcdctl/command/cluster_health.go @@ -46,9 +46,10 @@ func handleClusterHealth(c *cli.Context) { } // do we have a leader? - ep, ls0, err := getLeaderStats(tr, client.GetCluster()) + cl := client.GetCluster() + ep, ls0, err := getLeaderStats(tr, cl) if err != nil { - fmt.Println("cluster is unhealthy") + fmt.Println("cluster may be unhealthy: failed to connect", cl) os.Exit(1) }