From 4e9b097eb6b043c1f589bbaa39e8a7b996774a63 Mon Sep 17 00:00:00 2001 From: Jonathon Anderson Date: Thu, 7 Nov 2024 16:16:18 -0700 Subject: [PATCH] Only output node and profile list headers once Signed-off-by: Jonathon Anderson --- internal/pkg/api/node/list.go | 4 ++-- internal/pkg/api/profile/list.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/pkg/api/node/list.go b/internal/pkg/api/node/list.go index 6e4a5c2e..fc543f7f 100644 --- a/internal/pkg/api/node/list.go +++ b/internal/pkg/api/node/list.go @@ -82,9 +82,9 @@ func NodeList(nodeGet *wwapiv1.GetNodeList) (nodeList wwapiv1.NodeList, err erro strings.Join(n.SystemOverlay, ",")+"/"+strings.Join(n.RuntimeOverlay, ","))) } } else if nodeGet.Type == wwapiv1.GetNodeList_All { + nodeList.Output = append(nodeList.Output, + fmt.Sprintf("%s:=:%s:=:%s:=:%s", "NODE", "FIELD", "PROFILE", "VALUE")) for _, n := range node.FilterNodeListByName(nodes, nodeGet.Nodes) { - nodeList.Output = append(nodeList.Output, - fmt.Sprintf("%s:=:%s:=:%s:=:%s", "NODE", "FIELD", "PROFILE", "VALUE")) fields := nodeDB.GetFields(n) for _, f := range fields { nodeList.Output = append(nodeList.Output, diff --git a/internal/pkg/api/profile/list.go b/internal/pkg/api/profile/list.go index b6afdbdc..5d027943 100644 --- a/internal/pkg/api/profile/list.go +++ b/internal/pkg/api/profile/list.go @@ -28,9 +28,9 @@ func ProfileList(ShowOpt *wwapiv1.GetProfileList) (profileList wwapiv1.ProfileLi return profiles[i].Id() < profiles[j].Id() }) if ShowOpt.ShowAll { + profileList.Output = append(profileList.Output, + fmt.Sprintf("%s:=:%s:=:%s", "PROFILE", "FIELD", "VALUE")) for _, p := range profiles { - profileList.Output = append(profileList.Output, - fmt.Sprintf("%s:=:%s:=:%s", "PROFILE", "FIELD", "VALUE")) fields := nodeDB.GetFieldsProfile(p) for _, f := range fields { profileList.Output = append(profileList.Output,