This commit is contained in:
Carter Dodd
2022-06-04 11:42:16 -05:00
parent fc8d3863d8
commit f14f339576
4 changed files with 7 additions and 9 deletions

View File

@@ -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

View File

@@ -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()

View File

@@ -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
}

View File

@@ -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
}
}