don't show vars in overlay list

vars
This commit is contained in:
Christian Goll
2025-10-13 16:37:06 +02:00
committed by Jonathon Anderson
parent 5d284b1c61
commit 847a4386e1

View File

@@ -1,10 +1,7 @@
package list
import (
"os"
"strconv"
"strings"
"syscall"
"github.com/spf13/cobra"
"github.com/warewulf/warewulf/internal/app/wwctl/table"
@@ -33,11 +30,7 @@ func CobraRunE(vars *variables) func(cmd *cobra.Command, args []string) error {
if vars.ShowPath {
locationStr = "PATH"
}
if vars.ListLong {
t.AddHeader("PERM MODE", "UID", "GID", "OVERLAY", "FILE PATH", locationStr, "VARS")
} else {
t.AddHeader("OVERLAY NAME", "FILES/DIRS", locationStr)
}
for _, name := range overlays {
overlay_, err := overlay.Get(name)
@@ -50,32 +43,11 @@ func CobraRunE(vars *variables) func(cmd *cobra.Command, args []string) error {
files := util.FindFiles(overlay_.Rootfs())
wwlog.Debug("Iterating overlay rootfs: %s", overlay_.Rootfs())
if vars.ListLong {
for _, file := range files {
templateVars := []string{}
if !strings.HasSuffix(file, "/") {
templateVars = overlay_.ParseVars(file)
}
s, err := os.Stat(overlay_.File(file))
if err != nil {
wwlog.Warn("%s: %s: %s", name, file, err)
continue
}
fileMode := s.Mode()
perms := fileMode & os.ModePerm
sys := s.Sys()
locLine := strconv.FormatBool(overlay_.IsSiteOverlay())
if vars.ShowPath {
locLine = overlay_.Path()
}
t.AddLine(perms, sys.(*syscall.Stat_t).Uid, sys.(*syscall.Stat_t).Gid, name, file, locLine, templateVars)
}
} else {
locLine := strconv.FormatBool(overlay_.IsSiteOverlay())
if vars.ShowPath {
locLine = overlay_.Path()
}
if vars.ListContents {
if vars.ListContents || vars.ListLong {
var fileCount int
for file := range files {
t.AddLine(name, files[file], locLine)
@@ -88,7 +60,6 @@ func CobraRunE(vars *variables) func(cmd *cobra.Command, args []string) error {
t.AddLine(name, len(files), locLine)
}
}
}
t.Print()
return nil