pt-galera-log-explainer: refactor operator detection

This commit is contained in:
Yoann La Cancellera
2024-02-09 10:36:31 +01:00
parent dbf329ee23
commit 3a5bde7c36

View File

@@ -70,20 +70,14 @@ func main() {
utils.SkipColor = CLI.NoColor utils.SkipColor = CLI.NoColor
var paths []string for _, path := range kongcli.Path {
switch kongcli.Command() { if path.Positional != nil && path.Positional.Name == "paths" {
case "list <paths>": paths, ok := path.Positional.Target.Interface().([]string)
paths = CLI.List.Paths if ok && !CLI.PxcOperator && !CLI.SkipOperatorDetection && areOperatorFiles(paths) {
case "ctx <paths>": CLI.PxcOperator = true
paths = CLI.Ctx.Paths log.Info().Msg("Detected logs coming from Percona XtraDB Cluster Operator, enabling --pxc-operator")
case "conflicts <paths>": }
paths = CLI.Conflicts.Paths }
}
if !CLI.PxcOperator && !CLI.SkipOperatorDetection && areOperatorFiles(paths) {
CLI.PxcOperator = true
log.Info().Msg("Detected logs coming from Percona XtraDB Cluster Operator, enabling --pxc-operator")
} }
translate.AssumeIPStable = !CLI.PxcOperator translate.AssumeIPStable = !CLI.PxcOperator