Don't rebuild overlays on overlay commands automatically

This commit is contained in:
Gregory Kurtzer
2021-09-29 22:06:46 -07:00
parent 8d56a866e1
commit 499582e211
12 changed files with 7 additions and 242 deletions

View File

@@ -6,8 +6,6 @@ import (
"strconv"
"github.com/hpcng/warewulf/internal/pkg/config"
"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/wwlog"
@@ -69,37 +67,5 @@ func CobraRunE(cmd *cobra.Command, args []string) error {
os.Exit(1)
}
if !NoOverlayUpdate {
n, err := node.New()
if err != nil {
wwlog.Printf(wwlog.ERROR, "Could not open node configuration: %s\n", err)
os.Exit(1)
}
nodes, err := n.FindAllNodes()
if err != nil {
wwlog.Printf(wwlog.ERROR, "Could not get node list: %s\n", err)
os.Exit(1)
}
var updateNodes []node.NodeInfo
for _, node := range nodes {
if overlayKind == "system" && node.SystemOverlay.Get() == overlayName {
updateNodes = append(updateNodes, node)
} else if overlayKind == "runtime" && node.RuntimeOverlay.Get() == overlayName {
updateNodes = append(updateNodes, node)
}
}
if overlayKind == "system" {
wwlog.Printf(wwlog.INFO, "Updating System Overlays...\n")
return overlay.BuildSystemOverlay(updateNodes)
} else if overlayKind == "runtime" {
wwlog.Printf(wwlog.INFO, "Updating Runtime Overlays...\n")
return overlay.BuildRuntimeOverlay(updateNodes)
}
}
return nil
}