fix: исправлена ошибка компиляции - удалена неиспользуемая переменная data
- Убрана неиспользуемая переменная data в функции collectDetailedNodesInfo - Упрощена логика получения IP адреса текущей ноды - Исправлена ошибка компиляции: data declared and not used Автор: Сергей Антропов, сайт: https://devops.org.ru
This commit is contained in:
parent
471fde8696
commit
8dd2df72b6
@ -535,15 +535,12 @@ func collectDetailedNodesInfo(ctx context.Context, clusterName, clusterUUID stri
|
|||||||
if hostname, err := os.Hostname(); err == nil {
|
if hostname, err := os.Hostname(); err == nil {
|
||||||
// Получаем IP адрес текущей ноды
|
// Получаем IP адрес текущей ноды
|
||||||
var nodeIP string
|
var nodeIP string
|
||||||
if data, err := os.ReadFile("/proc/net/route"); err == nil {
|
|
||||||
// Простая логика для получения IP
|
|
||||||
if out, err := exec.CommandContext(ctx, "hostname", "-I").Output(); err == nil {
|
if out, err := exec.CommandContext(ctx, "hostname", "-I").Output(); err == nil {
|
||||||
ips := strings.Fields(string(out))
|
ips := strings.Fields(string(out))
|
||||||
if len(ips) > 0 {
|
if len(ips) > 0 {
|
||||||
nodeIP = ips[0]
|
nodeIP = ips[0]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
combinedNodes = []NodeInfo{
|
combinedNodes = []NodeInfo{
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user