reflections for unmarshal

This commit is contained in:
Christian Goll
2022-08-05 12:33:58 +02:00
parent d819eef792
commit 41d12888ab
8 changed files with 320 additions and 277 deletions

View File

@@ -5,7 +5,6 @@ import (
"os"
"github.com/hpcng/warewulf/internal/pkg/node"
"github.com/hpcng/warewulf/internal/pkg/util"
"github.com/hpcng/warewulf/internal/pkg/wwlog"
"github.com/manifoldco/promptui"
"github.com/pkg/errors"
@@ -36,10 +35,10 @@ func CobraRunE(cmd *cobra.Command, args []string) error {
os.Exit(1)
}
for _, n := range nodes {
for _, np := range n.Profiles {
for _, np := range n.Profiles.GetSlice() {
if np == r {
wwlog.Printf(wwlog.VERBOSE, "Removing profile from node %s: %s\n", n.Id.Get(), r)
n.Profiles = util.SliceRemoveElement(n.Profiles, r)
n.Profiles.SliceRemoveElement(r)
err := nodeDB.NodeUpdate(n)
if err != nil {
return errors.Wrap(err, "failed to update node")