fixup for backward compatible case

This commit is contained in:
Carter Dodd
2022-06-04 12:13:13 -05:00
parent f14f339576
commit 97c24e22f7

View File

@@ -3,6 +3,7 @@ package build
import (
"errors"
"os"
"strings"
"github.com/hpcng/warewulf/internal/pkg/node"
"github.com/hpcng/warewulf/internal/pkg/overlay"
@@ -39,6 +40,15 @@ func CobraRunE(cmd *cobra.Command, args []string) error {
}
}
// NOTE: this is to keep backward compatible
// passing -O a,b,c versus -O a -O b -O c, but will also accept -O a,b -O c
overlayNames := []string{}
for _, name := range OverlayNames {
names := strings.Split(name, ",")
overlayNames = append(overlayNames, names...)
}
OverlayNames = overlayNames
if OverlayDir != "" {
if len(OverlayNames) == 0 {
// TODO: should this behave the same as OverlayDir == "", and build default