From e80878b240f023e0a867b4560d7c78bb07216fde Mon Sep 17 00:00:00 2001 From: Gregory Kurtzer Date: Thu, 3 Dec 2020 19:37:52 -0800 Subject: [PATCH] Changed DomainName to ClusterName --- internal/app/wwctl/node/list/main.go | 6 +++--- internal/app/wwctl/node/set/main.go | 6 +++--- internal/app/wwctl/node/set/root.go | 6 +++--- internal/app/wwctl/profile/list/main.go | 1 + internal/app/wwctl/profile/set/main.go | 6 +++--- internal/app/wwctl/profile/set/root.go | 6 +++--- internal/pkg/node/constructors.go | 6 +++--- internal/pkg/node/datastructure.go | 4 ++-- internal/pkg/node/methods.go | 2 +- internal/pkg/node/modifiers.go | 3 ++- 10 files changed, 24 insertions(+), 22 deletions(-) diff --git a/internal/app/wwctl/node/list/main.go b/internal/app/wwctl/node/list/main.go index 13fcdc7e..5cc65f95 100644 --- a/internal/app/wwctl/node/list/main.go +++ b/internal/app/wwctl/node/list/main.go @@ -31,9 +31,9 @@ func CobraRunE(cmd *cobra.Command, args []string) error { } sort.Slice(nodes, func(i, j int) bool { - if nodes[i].DomainName.Get() < nodes[j].DomainName.Get() { + if nodes[i].ClusterName.Get() < nodes[j].ClusterName.Get() { return true - } else if nodes[i].DomainName.Get() == nodes[j].DomainName.Get() { + } else if nodes[i].ClusterName.Get() == nodes[j].ClusterName.Get() { if nodes[i].Id.Get() < nodes[j].Id.Get() { return true } @@ -47,7 +47,7 @@ func CobraRunE(cmd *cobra.Command, args []string) error { fmt.Printf("%-20s %-18s %-12s %s\n", "NODE", "FIELD", "PROFILE", "VALUE") fmt.Printf("%-20s %-18s %-12s %s\n", node.Id.Get(), "Id", node.Id.Source(), node.Id.Print()) fmt.Printf("%-20s %-18s %-12s %s\n", node.Id.Get(), "Comment", node.Comment.Source(), node.Comment.Print()) - fmt.Printf("%-20s %-18s %-12s %s\n", node.Id.Get(), "DomainName", node.DomainName.Source(), node.DomainName.Print()) + fmt.Printf("%-20s %-18s %-12s %s\n", node.Id.Get(), "ClusterName", node.ClusterName.Source(), node.ClusterName.Print()) fmt.Printf("%-20s %-18s %-12s %s\n", node.Id.Get(), "Profiles", "--", strings.Join(node.Profiles, ",")) fmt.Printf("%-20s %-18s %-12s %s\n", node.Id.Get(), "Vnfs", node.Vnfs.Source(), node.Vnfs.Print()) diff --git a/internal/app/wwctl/node/set/main.go b/internal/app/wwctl/node/set/main.go index e9c3a79c..cfc40362 100644 --- a/internal/app/wwctl/node/set/main.go +++ b/internal/app/wwctl/node/set/main.go @@ -76,10 +76,10 @@ func CobraRunE(cmd *cobra.Command, args []string) error { os.Exit(1) } } - if SetDomainName != "" { - wwlog.Printf(wwlog.VERBOSE, "Node: %s, Setting domain name to: %s\n", n.Id.Get(), SetDomainName) + if SetClusterName != "" { + wwlog.Printf(wwlog.VERBOSE, "Node: %s, Setting cluster name to: %s\n", n.Id.Get(), SetClusterName) - n.DomainName.Set(SetDomainName) + n.ClusterName.Set(SetClusterName) err := nodeDB.NodeUpdate(n) if err != nil { wwlog.Printf(wwlog.ERROR, "%s\n", err) diff --git a/internal/app/wwctl/node/set/root.go b/internal/app/wwctl/node/set/root.go index 900ce28f..d905accf 100644 --- a/internal/app/wwctl/node/set/root.go +++ b/internal/app/wwctl/node/set/root.go @@ -18,7 +18,7 @@ var ( SetGateway string SetHwaddr string SetNetDevDel bool - SetDomainName string + SetClusterName string SetIpxe string SetRuntimeOverlay string SetSystemOverlay string @@ -33,10 +33,10 @@ var ( ) func init() { - baseCmd.PersistentFlags().StringVarP(&SetComment, "comment", "C", "", "Set a comment for this node") + baseCmd.PersistentFlags().StringVar(&SetComment, "comment", "", "Set a comment for this node") baseCmd.PersistentFlags().StringVarP(&SetVnfs, "vnfs", "V", "", "Set node Virtual Node File System (VNFS)") baseCmd.PersistentFlags().StringVarP(&SetKernel, "kernel", "K", "", "Set Kernel version for nodes") - baseCmd.PersistentFlags().StringVarP(&SetDomainName, "domain", "D", "", "Set the node's domain name") + baseCmd.PersistentFlags().StringVarP(&SetClusterName, "cluster", "C", "", "Set the node's cluster name") baseCmd.PersistentFlags().StringVarP(&SetIpxe, "ipxe", "P", "", "Set the node's iPXE template name") baseCmd.PersistentFlags().StringVarP(&SetRuntimeOverlay, "runtime", "R", "", "Set the node's runtime overlay") baseCmd.PersistentFlags().StringVarP(&SetSystemOverlay, "system", "S", "", "Set the node's system overlay") diff --git a/internal/app/wwctl/profile/list/main.go b/internal/app/wwctl/profile/list/main.go index ab0416b2..8d3a925a 100644 --- a/internal/app/wwctl/profile/list/main.go +++ b/internal/app/wwctl/profile/list/main.go @@ -34,6 +34,7 @@ func CobraRunE(cmd *cobra.Command, args []string) error { fmt.Printf("################################################################################\n") fmt.Printf("%-20s %-18s: %s\n", node.Id.Get(), "Id", node.Id.Print()) fmt.Printf("%-20s %-18s: %s\n", node.Id.Get(), "Comment", node.Comment.Print()) + fmt.Printf("%-20s %-18s: %s\n", node.Id.Get(), "ClusterName", node.ClusterName.Print()) fmt.Printf("%-20s %-18s: %s\n", node.Id.Get(), "Vnfs", node.Vnfs.Print()) fmt.Printf("%-20s %-18s: %s\n", node.Id.Get(), "KernelVersion", node.KernelVersion.Print()) diff --git a/internal/app/wwctl/profile/set/main.go b/internal/app/wwctl/profile/set/main.go index 53daaf02..cc185f41 100644 --- a/internal/app/wwctl/profile/set/main.go +++ b/internal/app/wwctl/profile/set/main.go @@ -59,10 +59,10 @@ func CobraRunE(cmd *cobra.Command, args []string) error { os.Exit(1) } } - if SetDomainName != "" { - wwlog.Printf(wwlog.VERBOSE, "Profile: %s, Setting domain name to: %s\n", p.Id, SetDomainName) + if SetClusterName != "" { + wwlog.Printf(wwlog.VERBOSE, "Profile: %s, Setting cluster name to: %s\n", p.Id, SetClusterName) - p.DomainName.Set(SetDomainName) + p.ClusterName.Set(SetClusterName) err := nodeDB.ProfileUpdate(p) if err != nil { wwlog.Printf(wwlog.ERROR, "%s\n", err) diff --git a/internal/app/wwctl/profile/set/root.go b/internal/app/wwctl/profile/set/root.go index a2f38815..14e3269e 100644 --- a/internal/app/wwctl/profile/set/root.go +++ b/internal/app/wwctl/profile/set/root.go @@ -13,7 +13,7 @@ var ( SetComment string SetVnfs string SetKernel string - SetDomainName string + SetClusterName string SetIpxe string SetRuntimeOverlay string SetSystemOverlay string @@ -29,10 +29,10 @@ var ( ) func init() { - baseCmd.PersistentFlags().StringVarP(&SetComment, "comment", "C", "", "Set a comment for this node") + baseCmd.PersistentFlags().StringVar(&SetComment, "comment", "", "Set a comment for this node") baseCmd.PersistentFlags().StringVarP(&SetVnfs, "vnfs", "V", "", "Set node Virtual Node File System (VNFS)") baseCmd.PersistentFlags().StringVarP(&SetKernel, "kernel", "K", "", "Set Kernel version for nodes") - baseCmd.PersistentFlags().StringVarP(&SetDomainName, "domain", "D", "", "Set the node's domain name") + baseCmd.PersistentFlags().StringVarP(&SetClusterName, "cluster", "C", "", "Set the node's cluster name") baseCmd.PersistentFlags().StringVarP(&SetIpxe, "ipxe", "P", "", "Set the node's iPXE template name") baseCmd.PersistentFlags().StringVarP(&SetRuntimeOverlay, "runtime", "R", "", "Set the node's runtime overlay") baseCmd.PersistentFlags().StringVarP(&SetSystemOverlay, "system", "S", "", "Set the node's system overlay") diff --git a/internal/pkg/node/constructors.go b/internal/pkg/node/constructors.go index cf9a6860..70070760 100644 --- a/internal/pkg/node/constructors.go +++ b/internal/pkg/node/constructors.go @@ -48,7 +48,7 @@ func (self *nodeYaml) FindAllNodes() ([]NodeInfo, error) { fullname := strings.SplitN(nodename, ".", 2) if len(fullname) > 1 { - n.DomainName.SetDefault(fullname[1]) + n.ClusterName.SetDefault(fullname[1]) } if len(node.Profiles) == 0 { @@ -62,7 +62,7 @@ func (self *nodeYaml) FindAllNodes() ([]NodeInfo, error) { n.Vnfs.Set(node.Vnfs) n.KernelVersion.Set(node.KernelVersion) n.KernelArgs.Set(node.KernelArgs) - n.DomainName.Set(node.DomainName) + n.ClusterName.Set(node.ClusterName) n.Ipxe.Set(node.Ipxe) n.IpmiIpaddr.Set(node.IpmiIpaddr) n.IpmiNetmask.Set(node.IpmiNetmask) @@ -96,7 +96,7 @@ func (self *nodeYaml) FindAllNodes() ([]NodeInfo, error) { pstring := fmt.Sprintf("%s", p) n.Comment.SetAlt(self.NodeProfiles[p].Comment, pstring) - n.DomainName.SetAlt(self.NodeProfiles[p].DomainName, pstring) + n.ClusterName.SetAlt(self.NodeProfiles[p].ClusterName, pstring) n.Vnfs.SetAlt(self.NodeProfiles[p].Vnfs, pstring) n.KernelVersion.SetAlt(self.NodeProfiles[p].KernelVersion, pstring) n.KernelArgs.SetAlt(self.NodeProfiles[p].KernelArgs, pstring) diff --git a/internal/pkg/node/datastructure.go b/internal/pkg/node/datastructure.go index 54ad3c7f..8cf4219a 100644 --- a/internal/pkg/node/datastructure.go +++ b/internal/pkg/node/datastructure.go @@ -18,7 +18,7 @@ type nodeYaml struct { type NodeConf struct { Comment string `yaml:"comment,omitempty"` Disabled bool `yaml:"disabled,omitempty"` - DomainName string `yaml:"domain name,omitempty"` + ClusterName string `yaml:"cluster name,omitempty"` Vnfs string `yaml:"vnfs,omitempty"` Ipxe string `yaml:"ipxe template,omitempty"` KernelVersion string `yaml:"kernel version,omitempty"` @@ -59,7 +59,7 @@ type NodeInfo struct { Id Entry Cid Entry Comment Entry - DomainName Entry + ClusterName Entry Vnfs Entry Ipxe Entry KernelVersion Entry diff --git a/internal/pkg/node/methods.go b/internal/pkg/node/methods.go index caa221f7..9068831c 100644 --- a/internal/pkg/node/methods.go +++ b/internal/pkg/node/methods.go @@ -101,7 +101,7 @@ func (self *Entry) Print() string { return self.altvalue } if self.def != "" { - return self.def + return "(" + self.def + ")" } return "--" } diff --git a/internal/pkg/node/modifiers.go b/internal/pkg/node/modifiers.go index 6b9fa751..49bf6f06 100644 --- a/internal/pkg/node/modifiers.go +++ b/internal/pkg/node/modifiers.go @@ -55,7 +55,7 @@ func (self *nodeYaml) NodeUpdate(node NodeInfo) error { self.Nodes[nodeID].Comment = node.Comment.GetReal() self.Nodes[nodeID].Vnfs = node.Vnfs.GetReal() - self.Nodes[nodeID].DomainName = node.DomainName.GetReal() + self.Nodes[nodeID].ClusterName = node.ClusterName.GetReal() self.Nodes[nodeID].Ipxe = node.Ipxe.GetReal() self.Nodes[nodeID].KernelVersion = node.KernelVersion.GetReal() self.Nodes[nodeID].KernelArgs = node.KernelArgs.GetReal() @@ -127,6 +127,7 @@ func (self *nodeYaml) ProfileUpdate(profile NodeInfo) error { self.NodeProfiles[profileID].Comment = profile.Comment.GetReal() self.NodeProfiles[profileID].Vnfs = profile.Vnfs.GetReal() self.NodeProfiles[profileID].Ipxe = profile.Ipxe.GetReal() + self.NodeProfiles[profileID].ClusterName = profile.ClusterName.GetReal() self.NodeProfiles[profileID].KernelVersion = profile.KernelVersion.GetReal() self.NodeProfiles[profileID].KernelArgs = profile.KernelArgs.GetReal() self.NodeProfiles[profileID].IpmiIpaddr = profile.IpmiIpaddr.GetReal()