added profile set over API

This commit is contained in:
Christian Goll
2022-07-13 15:56:04 +02:00
parent f0eb3f8504
commit 14b86a5e8e
7 changed files with 188 additions and 440 deletions

View File

@@ -4,14 +4,14 @@ import (
"errors"
"fmt"
"github.com/hpcng/warewulf/internal/pkg/api/node"
apinode "github.com/hpcng/warewulf/internal/pkg/api/node"
"github.com/hpcng/warewulf/internal/pkg/api/routes/wwapiv1"
"github.com/hpcng/warewulf/internal/pkg/api/util"
"github.com/spf13/cobra"
)
func CobraRunE(cmd *cobra.Command, args []string) (err error) {
OptionStrMap, haveNetname := node.AddNetname(OptionStrMap)
OptionStrMap, haveNetname := apinode.AddNetname(OptionStrMap)
if !haveNetname {
return errors.New("a netname must be given for any network related configuration")
}
@@ -33,7 +33,7 @@ func CobraRunE(cmd *cobra.Command, args []string) (err error) {
var nodeCount uint
// The checks run twice in the prompt case.
// Avoiding putting in a blocking prompt in an API.
_, nodeCount, err = node.NodeSetParameterCheck(&set, false)
_, nodeCount, err = apinode.NodeSetParameterCheck(&set, false)
if err != nil {
return
}
@@ -42,5 +42,5 @@ func CobraRunE(cmd *cobra.Command, args []string) (err error) {
return
}
}
return node.NodeSet(&set)
return apinode.NodeSet(&set)
}

View File

@@ -37,17 +37,14 @@ var (
SetYes bool
SetForce bool
OptionStrMap map[string]*string
KernelStrMap map[string]*string
)
func init() {
//var emptyNodeConf node.NodeConf
//var emptyKernelE node.KernelEntry
// init empty helper structs, so that we know what's inside
myBase := node.CobraCommand{Command: baseCmd}
var emptyNodeConf node.NodeConf
emptyNodeConf.Kernel = new(node.KernelConf)
emptyNodeConf.Ipmi = new(node.IpmiConf)
//emptyNodeConf.NetDevs = make(map[string]*node.NetDevs)
OptionStrMap = myBase.CreateFlags(emptyNodeConf)
baseCmd.PersistentFlags().StringVarP(&SetNetDevDel, "netdel", "D", "", "Delete the node's network device")