diff --git a/internal/app/wwctl/node/list/main.go b/internal/app/wwctl/node/list/main.go index 16a9cc07..602687eb 100644 --- a/internal/app/wwctl/node/list/main.go +++ b/internal/app/wwctl/node/list/main.go @@ -69,7 +69,7 @@ func CobraRunE(cmd *cobra.Command, args []string) (err error) { if len(subkeys) >= 2 { switch subkeys[0] { case "key": - fieldName = "key:" + subkeys[1] + fieldName = "tag:" + subkeys[1] case "IpmiEntry": fieldName = ipmiLopt[subkeys[1]] case "KernelEntry": diff --git a/internal/pkg/node/constructors.go b/internal/pkg/node/constructors.go index e3bc7fa8..3fa8024d 100644 --- a/internal/pkg/node/constructors.go +++ b/internal/pkg/node/constructors.go @@ -85,6 +85,11 @@ func (config *NodeYaml) FindAllNodes() ([]NodeInfo, error) { n.Id.Set(nodename) nodeInfoType := reflect.TypeOf(&n) nodeInfoVal := reflect.ValueOf(&n) + // backward compatibilty + for keyname, key := range node.Keys { + node.Tags[keyname] = key + delete(node.Keys, keyname) + } nodeConfVal := reflect.ValueOf(node) // now iterate of every field for i := 0; i < nodeInfoType.Elem().NumField(); i++ { @@ -168,18 +173,6 @@ func (config *NodeYaml) FindAllNodes() ([]NodeInfo, error) { if len(node.Tags) == 0 { node.Tags = make(map[string]string) } - for keyname, key := range node.Keys { - node.Tags[keyname] = key - delete(node.Keys, keyname) - } - - for keyname, key := range node.Tags { - if _, ok := n.Tags[keyname]; !ok { - var key Entry - n.Tags[keyname] = &key - } - n.Tags[keyname].Set(key) - } for _, p := range n.Profiles { if _, ok := config.NodeProfiles[p]; !ok { diff --git a/internal/pkg/node/datastructure.go b/internal/pkg/node/datastructure.go index 8521122a..5f2d0e82 100644 --- a/internal/pkg/node/datastructure.go +++ b/internal/pkg/node/datastructure.go @@ -48,7 +48,7 @@ type NodeConf struct { Discoverable string `yaml:"discoverable,omitempty" lopt:"discoverable" comment:"Make discoverable in given network (yes/no)"` Profiles []string `yaml:"profiles,omitempty" lopt:"profile" sopt:"P" comment:"Set the node's profile members (comma separated)"` NetDevs map[string]*NetDevs `yaml:"network devices,omitempty"` - Tags map[string]string `yaml:"tags,omitempty" lopt:"keys" comment:"base key"` + Tags map[string]string `yaml:"tags,omitempty" lopt:"tag" comment:"base key"` Keys map[string]string `yaml:"keys,omitempty"` // Reverse compatibility } @@ -61,7 +61,7 @@ type IpmiConf struct { Gateway string `yaml:"gateway,omitempty" lopt:"ipmigateway" comment:"Set the IPMI gateway"` Interface string `yaml:"interface,omitempty" lopt:"ipmiinterface" comment:"Set the node's IPMI interface (defaults: 'lan')"` Write string `yaml:"write,omitempty" lopt:"ipmiwrite" comment:"Enable the write of impi configuration (yes/no)"` - Tags map[string]string `yaml:"tags,omitempty" lopt:"impitag" comment:"ipmi keys"` + Tags map[string]string `yaml:"tags,omitempty" lopt:"ipmitag" comment:"ipmi keys"` } type KernelConf struct { Version string `yaml:"version,omitempty"`