From 982816b47498fc6c554e73c03d58b55699e5a094 Mon Sep 17 00:00:00 2001 From: Gregory Kurtzer Date: Fri, 20 Nov 2020 23:03:18 -0800 Subject: [PATCH] Minor tweak for example --- internal/app/wwctl/node/set/main.go | 2 +- internal/pkg/node/node.go | 7 ++----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/internal/app/wwctl/node/set/main.go b/internal/app/wwctl/node/set/main.go index 5930757e..4b55199a 100644 --- a/internal/app/wwctl/node/set/main.go +++ b/internal/app/wwctl/node/set/main.go @@ -25,7 +25,7 @@ func CobraRunE(cmd *cobra.Command, args []string) error { if SetVnfs != "" { fmt.Printf("Setting vnfs to: %s\n", SetVnfs) - n = n.SetNodeVal("n0000", "vnfs", SetVnfs) + c, err = n.SetNodeVal("n0000", "vnfs", SetVnfs) } fmt.Printf("set count: %d\n", c) diff --git a/internal/pkg/node/node.go b/internal/pkg/node/node.go index fb1e4abf..c8bc9057 100644 --- a/internal/pkg/node/node.go +++ b/internal/pkg/node/node.go @@ -97,9 +97,8 @@ func New() (nodeYaml, error) { return ret, nil } -func (self nodeYaml) SetNodeVal(nodename string, entry string, value string) nodeYaml { +func (self nodeYaml) SetNodeVal(nodename string, entry string, value string) (int, error) { var count int - var ret = self for gname, group := range self.NodeGroups { for nname, _ := range group.Nodes { @@ -107,16 +106,14 @@ func (self nodeYaml) SetNodeVal(nodename string, entry string, value string) nod if entry == "vnfs" { var foo = self.NodeGroups[gname].Nodes[nname] foo.Vnfs = value -// self.NodeGroups[gname].Nodes[nname].Vnfs = value // node.Vnfs = value -// ret.NodeGroups[gname].Nodes[nname].Vnfs = value count++ } } } } - return ret + return count, nil } func (self *nodeYaml) Persist() error {