mirror of
https://codeberg.org/scip/esctl.git
synced 2026-08-24 06:24:18 +02:00
check at bootstrap which cluster is reachable, fix current cluster
This commit is contained in:
@@ -75,12 +75,24 @@ func ClusterCompare(conf *cfg.Config, leader, follower string) error {
|
||||
}
|
||||
|
||||
func ClusterList(conf *cfg.Config) error {
|
||||
table := NewTable(2, len(conf.Clusters))
|
||||
table.Addheaders("cluster", "uri")
|
||||
table := NewTable(3, len(conf.Clusters))
|
||||
|
||||
table.Addheaders("cluster", "uri", "default")
|
||||
|
||||
idx := 0
|
||||
for name, cluster := range conf.Clusters {
|
||||
table.entries[idx] = []string{name, cluster.Uri}
|
||||
current := name == "default" || name == conf.CurrentCluster
|
||||
|
||||
_, err := cluster.ES.Cluster.Health().
|
||||
Header("content-type", "application/json").
|
||||
Header("accept", "application/json").
|
||||
Do(context.Background())
|
||||
|
||||
if err == nil {
|
||||
name = Colorize("green", name)
|
||||
}
|
||||
|
||||
table.entries[idx] = []string{name, cluster.Uri, fmt.Sprintf("%t", current)}
|
||||
idx++
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user