diff --git a/internal/app/wwctl/node/list/main.go b/internal/app/wwctl/node/list/main.go index affa39e3..7c7d94a6 100644 --- a/internal/app/wwctl/node/list/main.go +++ b/internal/app/wwctl/node/list/main.go @@ -59,8 +59,8 @@ func CobraRunE(cmd *cobra.Command, args []string) error { fmt.Printf("%-20s %-18s %-12s %t\n", node.Id.Get(), name+":DEFAULT", netdev.Default.Source(), netdev.Default.PrintB()) } - for name, param := range node.Params { - fmt.Printf("%-20s %-18s %-12s %s\n", node.Id.Get(), name, param.Source(), param.Print()) + for name, key := range node.Keys { + fmt.Printf("%-20s %-18s %-12s %s\n", node.Id.Get(), name, key.Source(), key.Print()) } } diff --git a/internal/app/wwctl/node/set/main.go b/internal/app/wwctl/node/set/main.go index 9b0fbdce..ff45500c 100644 --- a/internal/app/wwctl/node/set/main.go +++ b/internal/app/wwctl/node/set/main.go @@ -326,33 +326,32 @@ func CobraRunE(cmd *cobra.Command, args []string) error { } if SetValue != "" { - if SetParam == "" { - wwlog.Printf(wwlog.ERROR, "You must include the '--param' option\n") + if SetKey == "" { + wwlog.Printf(wwlog.ERROR, "You must include the '--key/-k' option\n") os.Exit(1) } - if _, ok := n.Params[SetParam]; !ok { - wwlog.Printf(wwlog.VERBOSE, "Node: %s:%s, Setting Value %s\n", n.Id.Get(), SetParam, SetValue) + if _, ok := n.Keys[SetKey]; !ok { var nd node.Entry - n.Params[SetParam] = &nd + n.Keys[SetKey] = &nd } - wwlog.Printf(wwlog.VERBOSE, "Node: %s:%s, Setting Value %s\n", n.Id.Get(), SetParam, SetValue) - n.Params[SetParam].Set(SetValue) + wwlog.Printf(wwlog.VERBOSE, "Node: %s:%s, Setting Value %s\n", n.Id.Get(), SetKey, SetValue) + n.Keys[SetKey].Set(SetValue) } - if SetParamDel == true { - if SetParam == "" { - wwlog.Printf(wwlog.ERROR, "You must include the '--param' option\n") + if SetKeyDel == true { + if SetKey == "" { + wwlog.Printf(wwlog.ERROR, "You must include the '--key/-k' option\n") os.Exit(1) } - if _, ok := n.Params[SetParam]; !ok { - wwlog.Printf(wwlog.ERROR, "Custom parameter doesn't exist: %s\n", SetParam) + if _, ok := n.Keys[SetKey]; !ok { + wwlog.Printf(wwlog.ERROR, "Custom parameter doesn't exist: %s\n", SetKey) os.Exit(1) } wwlog.Printf(wwlog.VERBOSE, "Node: %s, Deleting custom parameter: %s\n", n.Id.Get(), SetNetDev) - delete(n.Params, SetParam) + delete(n.Keys, SetKey) } err := nodeDB.NodeUpdate(n) diff --git a/internal/app/wwctl/node/set/root.go b/internal/app/wwctl/node/set/root.go index cc708cd7..48c1531d 100644 --- a/internal/app/wwctl/node/set/root.go +++ b/internal/app/wwctl/node/set/root.go @@ -41,9 +41,9 @@ var ( SetDiscoverable bool SetUndiscoverable bool SetRoot string - SetParam string + SetKey string SetValue string - SetParamDel bool + SetKeyDel bool ) func init() { @@ -77,9 +77,10 @@ func init() { baseCmd.PersistentFlags().BoolVar(&SetNetDevDel, "netdel", false, "Delete the node's network device") baseCmd.PersistentFlags().BoolVar(&SetNetDevDefault, "netdefault", false, "Set this network to be default") - baseCmd.PersistentFlags().StringVarP(&SetParam, "param", "p", "", "Define custom parameter") - baseCmd.PersistentFlags().StringVarP(&SetValue, "value", "", "", "Set custom parameter value") - baseCmd.PersistentFlags().BoolVar(&SetParamDel, "paramdel", false, "Delete custom parameter") + baseCmd.PersistentFlags().StringVarP(&SetKey, "key", "k", "", "Define custom key") + baseCmd.PersistentFlags().BoolVar(&SetKeyDel, "keydel", false, "Delete custom key") + + baseCmd.PersistentFlags().StringVarP(&SetValue, "value", "", "", "Set value") baseCmd.PersistentFlags().BoolVarP(&SetNodeAll, "all", "a", false, "Set all nodes") diff --git a/internal/app/wwctl/profile/list/main.go b/internal/app/wwctl/profile/list/main.go index 0f453a71..38d28542 100644 --- a/internal/app/wwctl/profile/list/main.go +++ b/internal/app/wwctl/profile/list/main.go @@ -55,8 +55,8 @@ func CobraRunE(cmd *cobra.Command, args []string) error { fmt.Printf("%-20s %-18s %t\n", profile.Id.Get(), name+":DEFAULT", netdev.Default.PrintB()) } - for name, param := range profile.Params { - fmt.Printf("%-20s %-18s %s\n", profile.Id.Get(), name, param.Print()) + for name, key := range profile.Keys { + fmt.Printf("%-20s %-18s %s\n", profile.Id.Get(), name, key.Print()) } } } else { diff --git a/internal/app/wwctl/profile/set/main.go b/internal/app/wwctl/profile/set/main.go index c1af8e66..b7a2eda6 100644 --- a/internal/app/wwctl/profile/set/main.go +++ b/internal/app/wwctl/profile/set/main.go @@ -242,32 +242,32 @@ func CobraRunE(cmd *cobra.Command, args []string) error { } if SetValue != "" { - if SetParam == "" { - wwlog.Printf(wwlog.ERROR, "You must include the '--param' option\n") + if SetKey == "" { + wwlog.Printf(wwlog.ERROR, "You must include the '--key/-k' option\n") os.Exit(1) } - if _, ok := p.Params[SetParam]; !ok { + if _, ok := p.Keys[SetKey]; !ok { var nd node.Entry - p.Params[SetParam] = &nd + p.Keys[SetKey] = &nd } - wwlog.Printf(wwlog.VERBOSE, "Profile: %s:%s, Setting Value %s\n", p.Id.Get(), SetParam, SetValue) - p.Params[SetParam].Set(SetValue) + wwlog.Printf(wwlog.VERBOSE, "Profile: %s:%s, Setting Value %s\n", p.Id.Get(), SetKey, SetValue) + p.Keys[SetKey].Set(SetValue) } - if SetParamDel == true { - if SetParam == "" { - wwlog.Printf(wwlog.ERROR, "You must include the '--param' option\n") + if SetKeyDel == true { + if SetKey == "" { + wwlog.Printf(wwlog.ERROR, "You must include the '--key/-k' option\n") os.Exit(1) } - if _, ok := p.Params[SetParam]; !ok { - wwlog.Printf(wwlog.ERROR, "Custom parameter doesn't exist: %s\n", SetParam) + if _, ok := p.Keys[SetKey]; !ok { + wwlog.Printf(wwlog.ERROR, "Custom key doesn't exist: %s\n", SetKey) os.Exit(1) } - wwlog.Printf(wwlog.VERBOSE, "Profile: %s, Deleting custom parameter: %s\n", p.Id.Get(), SetNetDev) - delete(p.Params, SetParam) + wwlog.Printf(wwlog.VERBOSE, "Profile: %s, Deleting custom key: %s\n", p.Id.Get(), SetNetDev) + delete(p.Keys, SetKey) } err := nodeDB.ProfileUpdate(p) diff --git a/internal/app/wwctl/profile/set/root.go b/internal/app/wwctl/profile/set/root.go index 42e14995..2bc4b6e2 100644 --- a/internal/app/wwctl/profile/set/root.go +++ b/internal/app/wwctl/profile/set/root.go @@ -35,9 +35,9 @@ var ( SetNetDevDefault bool SetInit string SetRoot string - SetParam string + SetKey string SetValue string - SetParamDel bool + SetKeyDel bool ) func init() { @@ -66,9 +66,10 @@ func init() { baseCmd.PersistentFlags().BoolVar(&SetNetDevDel, "netdel", false, "Delete the node's network device") baseCmd.PersistentFlags().BoolVar(&SetNetDevDefault, "netdefault", false, "Set this network to be default") - baseCmd.PersistentFlags().StringVarP(&SetParam, "param", "p", "", "Define custom parameter") - baseCmd.PersistentFlags().StringVarP(&SetValue, "value", "", "", "Set custom parameter value") - baseCmd.PersistentFlags().BoolVar(&SetParamDel, "paramdel", false, "Delete custom parameter") + baseCmd.PersistentFlags().StringVarP(&SetKey, "key", "k", "", "Define custom key") + baseCmd.PersistentFlags().BoolVar(&SetKeyDel, "keydel", false, "Delete custom key") + + baseCmd.PersistentFlags().StringVarP(&SetValue, "value", "", "", "Set value") baseCmd.PersistentFlags().BoolVarP(&SetAll, "all", "a", false, "Set all profiles") baseCmd.PersistentFlags().BoolVarP(&SetForce, "force", "f", false, "Force configuration (even on error)") diff --git a/internal/pkg/node/constructors.go b/internal/pkg/node/constructors.go index 4e7e9d99..7f90342c 100644 --- a/internal/pkg/node/constructors.go +++ b/internal/pkg/node/constructors.go @@ -43,7 +43,7 @@ func (config *nodeYaml) FindAllNodes() ([]NodeInfo, error) { wwlog.Printf(wwlog.DEBUG, "In node loop: %s\n", nodename) n.NetDevs = make(map[string]*NetDevEntry) - n.Params = make(map[string]*Entry) + n.Keys = make(map[string]*Entry) n.SystemOverlay.SetDefault("default") n.RuntimeOverlay.SetDefault("default") n.Ipxe.SetDefault("default") @@ -95,12 +95,12 @@ func (config *nodeYaml) FindAllNodes() ([]NodeInfo, error) { n.NetDevs[devname].Default.SetB(netdev.Default) } - for paramname, param := range node.Params { - if _, ok := n.Params[paramname]; !ok { - var param Entry - n.Params[paramname] = ¶m + for keyname, key := range node.Keys { + if _, ok := n.Keys[keyname]; !ok { + var key Entry + n.Keys[keyname] = &key } - n.Params[paramname].Set(param) + n.Keys[keyname].Set(key) } for _, p := range n.Profiles { @@ -144,12 +144,12 @@ func (config *nodeYaml) FindAllNodes() ([]NodeInfo, error) { n.NetDevs[devname].Default.SetAltB(netdev.Default, p) } - for paramname, param := range config.NodeProfiles[p].Params { - if _, ok := n.Params[paramname]; !ok { - var param Entry - n.Params[paramname] = ¶m + for keyname, key := range config.NodeProfiles[p].Keys { + if _, ok := n.Keys[keyname]; !ok { + var key Entry + n.Keys[keyname] = &key } - n.Params[paramname].SetAlt(param, p) + n.Keys[keyname].SetAlt(key, p) } } @@ -177,7 +177,7 @@ func (config *nodeYaml) FindAllProfiles() ([]NodeInfo, error) { for name, profile := range config.NodeProfiles { var p NodeInfo p.NetDevs = make(map[string]*NetDevEntry) - p.Params = make(map[string]*Entry) + p.Keys = make(map[string]*Entry) p.Id.Set(name) p.Comment.Set(profile.Comment) @@ -212,12 +212,12 @@ func (config *nodeYaml) FindAllProfiles() ([]NodeInfo, error) { p.NetDevs[devname].Default.SetB(netdev.Default) } - for paramname, param := range profile.Params { - if _, ok := p.Params[paramname]; !ok { - var param Entry - p.Params[paramname] = ¶m + for keyname, key := range profile.Keys { + if _, ok := p.Keys[keyname]; !ok { + var key Entry + p.Keys[keyname] = &key } - p.Params[paramname].Set(param) + p.Keys[keyname].Set(key) } // TODO: Validate or die on all inputs diff --git a/internal/pkg/node/datastructure.go b/internal/pkg/node/datastructure.go index 243b0838..406c656d 100644 --- a/internal/pkg/node/datastructure.go +++ b/internal/pkg/node/datastructure.go @@ -36,7 +36,7 @@ type NodeConf struct { Discoverable bool `yaml:"discoverable,omitempty"` Profiles []string `yaml:"profiles,omitempty"` NetDevs map[string]*NetDevs `yaml:"network devices,omitempty"` - Params map[string]string `yaml:"parameters,omitempty"` + Keys map[string]string `yaml:"keys,omitempty"` } type NetDevs struct { @@ -83,7 +83,7 @@ type NodeInfo struct { Profiles []string GroupProfiles []string NetDevs map[string]*NetDevEntry - Params map[string]*Entry + Keys map[string]*Entry } type NetDevEntry struct { diff --git a/internal/pkg/node/modifiers.go b/internal/pkg/node/modifiers.go index 9a95b399..ce22dea1 100644 --- a/internal/pkg/node/modifiers.go +++ b/internal/pkg/node/modifiers.go @@ -75,7 +75,7 @@ func (config *nodeYaml) NodeUpdate(node NodeInfo) error { config.Nodes[nodeID].Profiles = node.Profiles config.Nodes[nodeID].NetDevs = make(map[string]*NetDevs) - config.Nodes[nodeID].Params = make(map[string]string) + config.Nodes[nodeID].Keys = make(map[string]string) for devname, netdev := range node.NetDevs { var newdev NetDevs @@ -89,8 +89,8 @@ func (config *nodeYaml) NodeUpdate(node NodeInfo) error { config.Nodes[nodeID].NetDevs[devname].Default = netdev.Default.GetRealB() } - for paramname, param := range node.Params { - config.Nodes[nodeID].Params[paramname] = param.GetReal() + for keyname, key := range node.Keys { + config.Nodes[nodeID].Keys[keyname] = key.GetReal() } return nil @@ -158,7 +158,7 @@ func (config *nodeYaml) ProfileUpdate(profile NodeInfo) error { config.NodeProfiles[profileID].Profiles = profile.Profiles config.NodeProfiles[profileID].NetDevs = make(map[string]*NetDevs) - config.NodeProfiles[profileID].Params = make(map[string]string) + config.NodeProfiles[profileID].Keys = make(map[string]string) for devname, netdev := range profile.NetDevs { var newdev NetDevs @@ -172,8 +172,8 @@ func (config *nodeYaml) ProfileUpdate(profile NodeInfo) error { config.NodeProfiles[profileID].NetDevs[devname].Default = netdev.Default.GetRealB() } - for paramname, param := range profile.Params { - config.NodeProfiles[profileID].Params[paramname] = param.GetReal() + for keyname, key := range profile.Keys { + config.NodeProfiles[profileID].Keys[keyname] = key.GetReal() } return nil diff --git a/internal/pkg/overlay/overlay.go b/internal/pkg/overlay/overlay.go index 46dbfc2d..7936e534 100644 --- a/internal/pkg/overlay/overlay.go +++ b/internal/pkg/overlay/overlay.go @@ -31,7 +31,7 @@ type TemplateStruct struct { IpmiUserName string IpmiPassword string NetDevs map[string]*node.NetDevs - Params map[string]string + Keys map[string]string AllNodes []node.NodeInfo } @@ -150,7 +150,7 @@ func buildOverlay(nodeList []node.NodeInfo, overlayType string) error { t.IpmiUserName = n.IpmiUserName.Get() t.IpmiPassword = n.IpmiPassword.Get() t.NetDevs = make(map[string]*node.NetDevs) - t.Params = make(map[string]string) + t.Keys = make(map[string]string) for devname, netdev := range n.NetDevs { var nd node.NetDevs t.NetDevs[devname] = &nd @@ -161,8 +161,8 @@ func buildOverlay(nodeList []node.NodeInfo, overlayType string) error { t.NetDevs[devname].Type = netdev.Type.Get() t.NetDevs[devname].Default = netdev.Default.GetB() } - for paramname, param := range n.Params { - t.Params[paramname] = param.Get() + for keyname, key := range n.Keys { + t.Keys[keyname] = key.Get() } t.AllNodes = allNodes