Use Node literal in MergeNode, not EmptyNode()

EmptyNode populates empty sub-structs, which interferes with omitempty during
serialization.

Signed-off-by: Jonathon Anderson <janderson@ciq.com>
This commit is contained in:
Jonathon Anderson
2024-12-27 13:39:29 -07:00
parent f0e634183e
commit dae8d004b3
8 changed files with 157 additions and 69 deletions

View File

@@ -76,9 +76,13 @@ func NodeList(nodeGet *wwapiv1.GetNodeList) (nodeList wwapiv1.NodeList, err erro
nodeList.Output = append(nodeList.Output,
fmt.Sprintf("%s:=:%s:=:%s:=:%s", "NODE NAME", "KERNEL VERSION", "CONTAINER", "OVERLAYS (S/R)"))
for _, n := range node.FilterNodeListByName(nodes, nodeGet.Nodes) {
kernelVersion := ""
if n.Kernel != nil {
kernelVersion = n.Kernel.Version
}
nodeList.Output = append(nodeList.Output,
fmt.Sprintf("%s:=:%s:=:%s:=:%s", n.Id(),
n.Kernel.Version,
kernelVersion,
n.ContainerName,
strings.Join(n.SystemOverlay, ",")+"/"+strings.Join(n.RuntimeOverlay, ",")))
}