Explorar o código

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.
Yicheng Qin %!s(int64=11) %!d(string=hai) anos
pai
achega
3d8fe3b3ca
Modificáronse 1 ficheiros con 3 adicións e 2 borrados
  1. 3 2
      etcdctl/command/cluster_health.go

+ 3 - 2
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)
 	}