Building set commands for nodes and groups and templating out CLI further
This commit is contained in:
22
internal/app/wwctl/node/add/main.go
Normal file
22
internal/app/wwctl/node/add/main.go
Normal 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
|
||||
}
|
||||
Reference in New Issue
Block a user