Refactor wwctl <node|profile> edit and fix bugs
`wwctl node edit` appears to not be working properly since MergeNode. This refactor, partly towards #918, resolves the issues with `node edit` and updates `profile edit` to match. Signed-off-by: Jonathon Anderson <janderson@ciq.com>
This commit is contained in:
@@ -10,8 +10,8 @@ import (
|
||||
"github.com/spf13/cobra"
|
||||
apinode "github.com/warewulf/warewulf/internal/pkg/api/node"
|
||||
"github.com/warewulf/warewulf/internal/pkg/api/routes/wwapiv1"
|
||||
apiutil "github.com/warewulf/warewulf/internal/pkg/api/util"
|
||||
"github.com/warewulf/warewulf/internal/pkg/node"
|
||||
"github.com/warewulf/warewulf/internal/pkg/util"
|
||||
"gopkg.in/yaml.v3"
|
||||
)
|
||||
|
||||
@@ -30,7 +30,7 @@ func CobraRunE(cmd *cobra.Command, args []string) error {
|
||||
if !ImportCVS {
|
||||
err = yaml.Unmarshal(buffer, importMap)
|
||||
if err == nil {
|
||||
yes := apiutil.ConfirmationPrompt(fmt.Sprintf("Are you sure you want to modify %d nodes", len(importMap)))
|
||||
yes := util.Confirm(fmt.Sprintf("Are you sure you want to modify %d nodes", len(importMap)))
|
||||
if yes {
|
||||
err = apinode.NodeAddFromYaml(&wwapiv1.NodeYaml{NodeConfMapYaml: string(buffer)})
|
||||
if err != nil {
|
||||
@@ -68,7 +68,7 @@ func CobraRunE(cmd *cobra.Command, args []string) error {
|
||||
}
|
||||
}
|
||||
}
|
||||
yes := apiutil.ConfirmationPrompt(fmt.Sprintf("Are you sure you want to import %d nodes", len(importMap)))
|
||||
yes := util.Confirm(fmt.Sprintf("Are you sure you want to import %d nodes", len(importMap)))
|
||||
if yes {
|
||||
// create second buffer an marshall nodeMap to it
|
||||
buffer, err = yaml.Marshal(importMap)
|
||||
|
||||
Reference in New Issue
Block a user