Fix for overlay builds

This commit is contained in:
Gregory Kurtzer
2021-09-17 21:48:29 -07:00
parent 8ddebe8d77
commit 71b9ea714f
2 changed files with 11 additions and 5 deletions

View File

@@ -12,11 +12,17 @@ import (
func CobraRunE(cmd *cobra.Command, args []string) error {
var updateNodes []node.NodeInfo
var overlayKind string
var overlayName string
overlayKind := args[0]
overlayName := args[1]
if len(args) == 2 {
overlayKind = args[0]
overlayName = args[1]
} else if len(args) == 1 {
overlayKind = args[0]
}
if overlayKind != "system" && overlayKind != "runtime" {
if (overlayKind != "system" && overlayKind != "runtime") && !BuildAll {
return errors.New("overlay kind must be of type 'system' or 'runtime'")
}
@@ -26,7 +32,7 @@ func CobraRunE(cmd *cobra.Command, args []string) error {
os.Exit(1)
}
if len(args) > 0 && !BuildAll {
if overlayName != "" {
nodes, err := n.FindAllNodes()
if err != nil {
wwlog.Printf(wwlog.ERROR, "Could not get node list: %s\n", err)

View File

@@ -8,7 +8,7 @@ var (
Short: "(Re)build an overlay",
Long: "This command will build a system or runtime overlay.",
RunE: CobraRunE,
Args: cobra.ExactArgs(2),
Args: cobra.RangeArgs(0, 2),
}
BuildAll bool
)