mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-11 13:40:07 +00:00
Fix: don't cut node name if it's an ip
rare case, but it was not producing great results regression tests will come for this
This commit is contained in:
@@ -3,6 +3,8 @@ package utils
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"k8s.io/utils/net"
|
||||
)
|
||||
|
||||
// Color is given its own type for safe function signatures
|
||||
@@ -118,6 +120,10 @@ func ShortNodeName(s string) string {
|
||||
if len(s) < 10 {
|
||||
return s
|
||||
}
|
||||
// for the rare case of having IPs set as node names
|
||||
if net.IsIPv4String(s) {
|
||||
return s
|
||||
}
|
||||
before, _, _ := strings.Cut(s, ".")
|
||||
return before
|
||||
}
|
||||
|
Reference in New Issue
Block a user