From 14b45e37c0b7e11c544532fb09ad62c8bf85f265 Mon Sep 17 00:00:00 2001 From: Jonathon Anderson Date: Fri, 16 Sep 2022 21:33:49 +0000 Subject: [PATCH] Fix output of wwctl container show Commit d8cd6049 introduced erroneous output coming from an inner function of container show, and (seemingly) erroneously replaces valid kernel versions with "not found". This commit fixes both of those issues, and moves the output to the outer cli function. --- internal/app/wwctl/container/show/main.go | 1 + internal/pkg/api/container/container.go | 4 +--- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/internal/app/wwctl/container/show/main.go b/internal/app/wwctl/container/show/main.go index accc42b3..749e1bb6 100644 --- a/internal/app/wwctl/container/show/main.go +++ b/internal/app/wwctl/container/show/main.go @@ -25,6 +25,7 @@ func CobraRunE(cmd *cobra.Command, args []string) (err error) { fmt.Printf("%s\n", r.Rootfs) } else { fmt.Printf("Name: %s\n", r.Name) + fmt.Printf("KernelVersion: %s\n", r.KernelVersion) fmt.Printf("Rootfs: %s\n", r.Rootfs) fmt.Printf("Nr nodes: %d\n", len(r.Nodes)) fmt.Printf("Nodes: %s\n", r.Nodes) diff --git a/internal/pkg/api/container/container.go b/internal/pkg/api/container/container.go index ce546b26..ba31cc88 100644 --- a/internal/pkg/api/container/container.go +++ b/internal/pkg/api/container/container.go @@ -315,9 +315,8 @@ func ContainerShow(csp *wwapiv1.ContainerShowParameter) (response *wwapiv1.Conta rootFsDir := container.RootFsDir(containerName) kernelVersion := container.KernelVersion(containerName) - if kernelVersion != "" { + if kernelVersion == "" { kernelVersion = "not found" - fmt.Printf("Kernelversion: %s\n", kernelVersion) } nodeDB, err := node.New() @@ -333,7 +332,6 @@ func ContainerShow(csp *wwapiv1.ContainerShowParameter) (response *wwapiv1.Conta var nodeList []string for _, n := range nodes { if n.ContainerName.Get() == containerName { - nodeList = append(nodeList, n.Id.Get()) } }