A bunch of changes including reworking the assets -> node API

This commit is contained in:
Gregory Kurtzer
2020-11-20 17:59:06 -08:00
parent dd2d83788a
commit 221e71b384
28 changed files with 367 additions and 291 deletions

View File

@@ -1,20 +1,26 @@
package build
import (
"github.com/hpcng/warewulf/internal/pkg/assets"
"github.com/hpcng/warewulf/internal/pkg/kernel"
"github.com/hpcng/warewulf/internal/pkg/node"
"github.com/hpcng/warewulf/internal/pkg/wwlog"
"github.com/spf13/cobra"
"os"
)
func CobraRunE(cmd *cobra.Command, args []string) error {
var nodes []assets.NodeInfo
var nodes []node.NodeInfo
set := make(map[string]int)
n, err := node.New()
if err != nil {
wwlog.Printf(wwlog.ERROR, "Could not open node configuration: %s\n", err)
os.Exit(1)
}
if len(args) == 1 && ByNode == true {
var err error
nodes, err = assets.SearchByName(args[0])
nodes, err = n.SearchByName(args[0])
if err != nil {
wwlog.Printf(wwlog.ERROR, "Could not find nodes for search term: %s\n", args[0])
os.Exit(1)
@@ -26,7 +32,7 @@ func CobraRunE(cmd *cobra.Command, args []string) error {
} else if BuildAll == true {
var err error
nodes, err = assets.FindAllNodes()
nodes, err = n.FindAllNodes()
if err != nil {
wwlog.Printf(wwlog.ERROR, "Could not get list of nodes: %s\n", err)
os.Exit(1)