added profile set over API
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user