From 720a565e7ce1f0f65ee79d73dcfb064059570b72 Mon Sep 17 00:00:00 2001 From: David Elie-Dit-Cosaque <86730676+edcdavid@users.noreply.github.com> Date: Tue, 12 Dec 2023 03:21:40 -0600 Subject: [PATCH] Fix for fatal error in diagnostics (#1715) --- pkg/diagnostics/diagnostics.go | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/pkg/diagnostics/diagnostics.go b/pkg/diagnostics/diagnostics.go index 64ee450b8b..4f559795cd 100644 --- a/pkg/diagnostics/diagnostics.go +++ b/pkg/diagnostics/diagnostics.go @@ -85,14 +85,16 @@ func GetHwInfoAllNodes() (out map[string]NodeHwInfo) { hw := NodeHwInfo{} lscpu, err := getHWJsonOutput(debugPod, o, lscpuCommand) if err != nil { - logrus.Errorf("problem getting lscpu for node %s", debugPod.Spec.NodeName) + logrus.Error("problem getting lscpu for node %s", debugPod.Spec.NodeName) + } else { + var ok bool + temp, ok := lscpu.(map[string]interface{}) + if !ok { + logrus.Error("problem casting lscpu field for node %s, lscpu=%v", debugPod.Spec.NodeName, lscpu) + } else { + hw.Lscpu = temp["lscpu"] + } } - var ok bool - hw.Lscpu, ok = lscpu.(map[string]interface{})["lscpu"] - if !ok { - logrus.Errorf("problem casting lscpu field for node %s, lscpu=%v", debugPod.Spec.NodeName, lscpu) - } - hw.IPconfig, err = getHWJsonOutput(debugPod, o, ipCommand) if err != nil { logrus.Errorf("problem getting ip config for node %s", debugPod.Spec.NodeName)