From 5e53ff1b7d68b94b01527eddcbc4adfa19971983 Mon Sep 17 00:00:00 2001 From: Gregory Kurtzer Date: Sun, 25 Apr 2021 13:41:21 -0700 Subject: [PATCH] Remove useless "Disable" (ref #40) --- internal/app/wwctl/node/list/main.go | 9 ++++----- internal/pkg/node/constructors.go | 3 --- internal/pkg/node/datastructure.go | 2 -- internal/pkg/node/modifiers.go | 2 -- 4 files changed, 4 insertions(+), 12 deletions(-) diff --git a/internal/app/wwctl/node/list/main.go b/internal/app/wwctl/node/list/main.go index ce856c8b..ec04ea25 100644 --- a/internal/app/wwctl/node/list/main.go +++ b/internal/app/wwctl/node/list/main.go @@ -31,7 +31,7 @@ func CobraRunE(cmd *cobra.Command, args []string) error { os.Exit(1) } - if ShowAll == true { + if ShowAll { for _, node := range nodes { fmt.Printf("################################################################################\n") fmt.Printf("%-20s %-18s %-12s %s\n", "NODE", "FIELD", "PROFILE", "VALUE") @@ -40,7 +40,6 @@ func CobraRunE(cmd *cobra.Command, args []string) error { 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 %t\n", node.Id.Get(), "Disabled", node.Disabled.Source(), node.Disabled.PrintB()) fmt.Printf("%-20s %-18s %-12s %t\n", node.Id.Get(), "Discoverable", node.Discoverable.Source(), node.Discoverable.PrintB()) fmt.Printf("%-20s %-18s %-12s %s\n", node.Id.Get(), "ContainerName", node.ContainerName.Source(), node.ContainerName.Print()) @@ -73,7 +72,7 @@ func CobraRunE(cmd *cobra.Command, args []string) error { // } } - } else if ShowNet == true { + } else if ShowNet { fmt.Printf("%-22s %-6s %-18s %-15s %-15s\n", "NODE NAME", "DEVICE", "HWADDR", "IPADDR", "GATEWAY") fmt.Println(strings.Repeat("=", 80)) @@ -87,7 +86,7 @@ func CobraRunE(cmd *cobra.Command, args []string) error { } } - } else if ShowIpmi == true { + } else if ShowIpmi { fmt.Printf("%-22s %-16s %-20s %-20s\n", "NODE NAME", "IPMI IPADDR", "IPMI USERNAME", "IPMI PASSWORD") fmt.Println(strings.Repeat("=", 80)) @@ -95,7 +94,7 @@ func CobraRunE(cmd *cobra.Command, args []string) error { fmt.Printf("%-22s %-16s %-20s %-20s\n", node.Id.Get(), node.IpmiIpaddr.Print(), node.IpmiUserName.Print(), node.IpmiPassword.Print()) } - } else if ShowLong == true { + } else if ShowLong { fmt.Printf("%-22s %-26s %-35s %s\n", "NODE NAME", "KERNEL VERSION", "CONTAINER", "OVERLAYS (S/R)") fmt.Println(strings.Repeat("=", 120)) diff --git a/internal/pkg/node/constructors.go b/internal/pkg/node/constructors.go index 28f20906..1aeff240 100644 --- a/internal/pkg/node/constructors.go +++ b/internal/pkg/node/constructors.go @@ -80,7 +80,6 @@ func (config *nodeYaml) FindAllNodes() ([]NodeInfo, error) { n.Root.Set(node.Root) n.Discoverable.SetB(node.Discoverable) - n.Disabled.SetB(node.Disabled) for devname, netdev := range node.NetDevs { if _, ok := n.NetDevs[devname]; !ok { @@ -120,7 +119,6 @@ func (config *nodeYaml) FindAllNodes() ([]NodeInfo, error) { n.RuntimeOverlay.SetAlt(config.NodeProfiles[p].RuntimeOverlay, p) n.Root.SetAlt(config.NodeProfiles[p].Root, p) - n.Disabled.SetAltB(config.NodeProfiles[p].Disabled, p) n.Discoverable.SetAltB(config.NodeProfiles[p].Discoverable, p) for devname, netdev := range config.NodeProfiles[p].NetDevs { @@ -179,7 +177,6 @@ func (config *nodeYaml) FindAllProfiles() ([]NodeInfo, error) { p.SystemOverlay.Set(profile.SystemOverlay) p.Root.Set(profile.Root) - p.Disabled.SetB(profile.Disabled) p.Discoverable.SetB(profile.Discoverable) for devname, netdev := range profile.NetDevs { diff --git a/internal/pkg/node/datastructure.go b/internal/pkg/node/datastructure.go index e6fab2cd..67427052 100644 --- a/internal/pkg/node/datastructure.go +++ b/internal/pkg/node/datastructure.go @@ -19,7 +19,6 @@ type nodeYaml struct { type NodeConf struct { Comment string `yaml:"comment,omitempty"` - Disabled bool `yaml:"disabled,omitempty"` ClusterName string `yaml:"cluster name,omitempty"` ContainerName string `yaml:"container name,omitempty"` Ipxe string `yaml:"ipxe template,omitempty"` @@ -79,7 +78,6 @@ type NodeInfo struct { SystemOverlay Entry Root Entry Discoverable Entry - Disabled Entry Init Entry //TODO: Finish adding this... Profiles []string GroupProfiles []string diff --git a/internal/pkg/node/modifiers.go b/internal/pkg/node/modifiers.go index 0f11c9b4..41a81b2d 100644 --- a/internal/pkg/node/modifiers.go +++ b/internal/pkg/node/modifiers.go @@ -70,7 +70,6 @@ func (config *nodeYaml) NodeUpdate(node NodeInfo) error { config.Nodes[nodeID].SystemOverlay = node.SystemOverlay.GetReal() config.Nodes[nodeID].Root = node.Root.GetReal() - config.Nodes[nodeID].Disabled = node.Disabled.GetRealB() config.Nodes[nodeID].Discoverable = node.Discoverable.GetRealB() config.Nodes[nodeID].Profiles = node.Profiles @@ -148,7 +147,6 @@ func (config *nodeYaml) ProfileUpdate(profile NodeInfo) error { config.NodeProfiles[profileID].SystemOverlay = profile.SystemOverlay.GetReal() config.NodeProfiles[profileID].Root = profile.Root.GetReal() - config.NodeProfiles[profileID].Disabled = profile.Disabled.GetRealB() config.NodeProfiles[profileID].Discoverable = profile.Discoverable.GetRealB() config.NodeProfiles[profileID].Profiles = profile.Profiles