Building set commands for nodes and groups and templating out CLI further

This commit is contained in:
Gregory Kurtzer
2020-11-21 01:48:38 -08:00
parent 982816b474
commit 1d1a02b305
14 changed files with 305 additions and 39 deletions

View File

@@ -0,0 +1,22 @@
package add
import (
"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 {
nodeDB, err := node.New()
if err != nil {
wwlog.Printf(wwlog.ERROR, "Failed to open node database: %s\n", err)
os.Exit(1)
}
nodeDB.AddNode(args[0], args[1])
nodeDB.Persist()
return nil
}