From 0ff05722a94bfec9c805f3a35ff8dfecd0562f79 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 | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/pkg/diagnostics/diagnostics.go b/pkg/diagnostics/diagnostics.go index 64ee450b8..a513d6b4b 100644 --- a/pkg/diagnostics/diagnostics.go +++ b/pkg/diagnostics/diagnostics.go @@ -86,13 +86,15 @@ func GetHwInfoAllNodes() (out map[string]NodeHwInfo) { lscpu, err := getHWJsonOutput(debugPod, o, lscpuCommand) if err != nil { logrus.Errorf("problem getting lscpu for node %s", debugPod.Spec.NodeName) + } else { + var ok bool + temp, ok := lscpu.(map[string]interface{}) + if !ok { + logrus.Errorf("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)