From f14f33957649e718a90d69512d70ba40c0f3ac0f Mon Sep 17 00:00:00 2001 From: Carter Dodd Date: Sat, 4 Jun 2022 11:42:16 -0500 Subject: [PATCH] fixups --- internal/app/wwctl/overlay/build/main.go | 4 +--- internal/app/wwctl/overlay/build/root.go | 2 +- internal/pkg/util/util.go | 4 ++-- internal/pkg/warewulfd/provision.go | 6 +++--- 4 files changed, 7 insertions(+), 9 deletions(-) diff --git a/internal/app/wwctl/overlay/build/main.go b/internal/app/wwctl/overlay/build/main.go index 4477e6ef..324cfc3e 100644 --- a/internal/app/wwctl/overlay/build/main.go +++ b/internal/app/wwctl/overlay/build/main.go @@ -3,11 +3,9 @@ package build import ( "errors" "os" - "strings" "github.com/hpcng/warewulf/internal/pkg/node" "github.com/hpcng/warewulf/internal/pkg/overlay" - "github.com/hpcng/warewulf/internal/pkg/util" "github.com/hpcng/warewulf/internal/pkg/warewulfconf" "github.com/hpcng/warewulf/internal/pkg/wwlog" "github.com/hpcng/warewulf/pkg/hostlist" @@ -54,7 +52,7 @@ func CobraRunE(cmd *cobra.Command, args []string) error { } for _, node := range nodes { - return overlay.BuildOverlayIndir(node, OverlayNames), OverlayDir) + return overlay.BuildOverlayIndir(node, OverlayNames, OverlayDir) } } else { // TODO this seems different than what is set in BuildHostOverlay diff --git a/internal/app/wwctl/overlay/build/root.go b/internal/app/wwctl/overlay/build/root.go index 958a9c92..b9971519 100644 --- a/internal/app/wwctl/overlay/build/root.go +++ b/internal/app/wwctl/overlay/build/root.go @@ -38,7 +38,7 @@ var ( func init() { baseCmd.PersistentFlags().BoolVarP(&BuildHost, "host", "H", false, "Build overlays only for the host") baseCmd.PersistentFlags().BoolVarP(&BuildNodes, "nodes", "N", false, "Build overlays only for the nodes") - baseCmd.PersistentFlags().StringSliceVar(&OverlayNames, "overlay", "O", []string{}, "Build only specific overlay(s)") + baseCmd.PersistentFlags().StringSliceVarP(&OverlayNames, "overlay", "O", []string{}, "Build only specific overlay(s)") if err := baseCmd.RegisterFlagCompletionFunc("overlay", func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { list, _ := overlay.FindOverlays() diff --git a/internal/pkg/util/util.go b/internal/pkg/util/util.go index 9b7aca45..e5367be7 100644 --- a/internal/pkg/util/util.go +++ b/internal/pkg/util/util.go @@ -658,11 +658,11 @@ func BuildFsImage( /******************************************************************************* Runs wwctl command */ -func RunWWCTL(args ...string) (out string, err error) { +func RunWWCTL(args ...string) (out []byte, err error) { proc := exec.Command("wwctl", args...) - out, err := proc.CombinedOutput() + out, err = proc.CombinedOutput() return out, err } diff --git a/internal/pkg/warewulfd/provision.go b/internal/pkg/warewulfd/provision.go index 7cd2bfca..a1416a7b 100644 --- a/internal/pkg/warewulfd/provision.go +++ b/internal/pkg/warewulfd/provision.go @@ -162,7 +162,7 @@ func ProvisionSend(w http.ResponseWriter, req *http.Request) { if !util.IsFile(stage_file) || util.PathIsNewer(stage_file, nodepkg.ConfigFile) || oneoverlaynewer { wwlog.Serv("BUILD %15s, overlays %v", node.Id.Get(), stage_overlays) - args := []string{} + args := []string{"overlay", "build"} for _, overlayname := range stage_overlays { args = append(args, "-O", overlayname) @@ -170,11 +170,11 @@ func ProvisionSend(w http.ResponseWriter, req *http.Request) { args = append(args, node.Id.Get()) - out, err := util.RunWWCTL("overlay", "build", args...) + out, err := util.RunWWCTL(args...) if err != nil { w.WriteHeader(http.StatusInternalServerError) - wwlog.ErrorExc(err, out) + wwlog.ErrorExc(err, string(out)) return } }