also fix color status in ccr status

This commit is contained in:
2026-05-27 09:59:56 +02:00
parent c92f10fb5d
commit b2da6f0f29
2 changed files with 11 additions and 5 deletions

View File

@@ -25,7 +25,7 @@ import (
"sync"
"codeberg.org/scip/esctl/pkg/cfg"
"codeberg.org/scip/esctl/pkg/printer"
"codeberg.org/scip/esctl/pkg/printer"
"github.com/elastic/go-elasticsearch/v9"
"github.com/elastic/go-elasticsearch/v9/typedapi/cluster/health"
"github.com/elastic/go-elasticsearch/v9/typedapi/types"
@@ -75,14 +75,15 @@ func checkClusterStatus(conf *cfg.Config, leader, follower string) bool {
status[cluster] = st
}
table := printer.NewTable(conf, 3, 5)
table := printer.NewTable(conf, 3, 6)
table.Addheaders("setting", "leader:"+leader, "follower:"+follower)
table.Entries = [][]string{
{"Cluster Name",
printer.Colorize(conf, status[leader].Status.Name, status[leader].ClusterName),
printer.Colorize(conf, status[follower].Status.Name, status[follower].ClusterName),
{"Cluster Name", status[leader].ClusterName, status[follower].ClusterName},
{"Cluster Status",
printer.Colorize(conf, status[leader].Status.Name, status[leader].Status.Name),
printer.Colorize(conf, status[follower].Status.Name, status[follower].Status.Name),
},
{"Active Shards",
fmt.Sprintf("%d", status[leader].ActiveShards),
@@ -107,6 +108,8 @@ func checkClusterStatus(conf *cfg.Config, leader, follower string) bool {
return false
}
fmt.Println()
if status[leader].Status.Name == "green" && status[follower].Status.Name == "green" {
return true
}