From 2fef9bfd77a59d31441e53754c83c7ac52cd89e3 Mon Sep 17 00:00:00 2001 From: Gregory Kurtzer Date: Fri, 20 Aug 2021 19:34:29 -0700 Subject: [PATCH 01/11] Cleanup for `ready` command --- internal/app/wwctl/ready/main.go | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/app/wwctl/ready/main.go b/internal/app/wwctl/ready/main.go index 2df4b33d..f77481f4 100644 --- a/internal/app/wwctl/ready/main.go +++ b/internal/app/wwctl/ready/main.go @@ -27,7 +27,7 @@ func CobraRunE(cmd *cobra.Command, args []string) error { os.Exit(1) } - fmt.Printf("%-25s %-10s %-6s %-6s %-6s %-6s %-6s\n", "NODE NAME", "STATUS", "VNFS", "KERNEL", "KMODS", "SYS-OL", "RUN-OL") + fmt.Printf("%-25s %-10s %-6s %-6s %-6s %-6s %-6s\n", "NODE NAME", "READY", "VNFS", "KERNEL", "KMODS", "SYS-OL", "RUN-OL") for _, node := range nodes { var vnfs_good bool @@ -35,7 +35,7 @@ func CobraRunE(cmd *cobra.Command, args []string) error { var kmods_good bool var systemo_good bool var runtimeo_good bool - status := true + ready := true if node.ContainerName.Get() != "" { vnfsImage := container.ImageFile(node.ContainerName.Get()) @@ -43,11 +43,11 @@ func CobraRunE(cmd *cobra.Command, args []string) error { if util.IsFile(vnfsImage) == true { vnfs_good = true } else { - status = false + ready = false wwlog.Printf(wwlog.VERBOSE, "VNFS not found: %s, %s\n", node.Id.Get(), vnfsImage) } } else { - status = false + ready = false wwlog.Printf(wwlog.VERBOSE, "Node Kernel not defined: %s\n", node.Id.Get()) } @@ -55,17 +55,17 @@ func CobraRunE(cmd *cobra.Command, args []string) error { if util.IsFile(kernel.KernelImage(node.KernelVersion.Get())) == true { kernel_good = true } else { - status = false + ready = false wwlog.Printf(wwlog.VERBOSE, "Node Kernel not found: %s, %s\n", node.Id.Get(), node.KernelVersion.Get()) } if util.IsFile(kernel.KmodsImage(node.KernelVersion.Get())) == true { kmods_good = true } else { - status = false + ready = false wwlog.Printf(wwlog.VERBOSE, "Node Kmods not found: %s, %s\n", node.Id.Get(), node.KernelVersion.Get()) } } else { - status = false + ready = false wwlog.Printf(wwlog.VERBOSE, "Node Kernel version not defined: %s\n", node.Id.Get()) } @@ -73,11 +73,11 @@ func CobraRunE(cmd *cobra.Command, args []string) error { if util.IsFile(config.SystemOverlayImage(node.Id.Get())) == true { systemo_good = true } else { - status = false + ready = false wwlog.Printf(wwlog.VERBOSE, "System Overlay not found: %s\n", config.SystemOverlayImage(node.Id.Get())) } } else { - status = false + ready = false wwlog.Printf(wwlog.VERBOSE, "System Overlay not defined: %s\n", node.Id.Get()) } @@ -85,15 +85,15 @@ func CobraRunE(cmd *cobra.Command, args []string) error { if util.IsFile(config.RuntimeOverlayImage(node.Id.Get())) == true { runtimeo_good = true } else { - status = false + ready = false wwlog.Printf(wwlog.VERBOSE, "Runtime Overlay not found: %s\n", config.RuntimeOverlaySource(node.Id.Get())) } } else { - status = false + ready = false wwlog.Printf(wwlog.VERBOSE, "Runtime Overlay not defined: %s\n", node.Id.Get()) } - fmt.Printf("%-25s %-10t %-6t %-6t %-6t %-6t %-6t\n", node.Id.Get(), status, vnfs_good, kernel_good, kmods_good, systemo_good, runtimeo_good) + fmt.Printf("%-25s %-10t %-6t %-6t %-6t %-6t %-6t\n", node.Id.Get(), ready, vnfs_good, kernel_good, kmods_good, systemo_good, runtimeo_good) } return nil From c88e062a6255998151d6776433ac15f9ac35544d Mon Sep 17 00:00:00 2001 From: Gregory Kurtzer Date: Fri, 20 Aug 2021 19:39:02 -0700 Subject: [PATCH 02/11] Match kernel list output header for node count --- internal/app/wwctl/kernel/list/main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/app/wwctl/kernel/list/main.go b/internal/app/wwctl/kernel/list/main.go index c72f4406..d209e786 100644 --- a/internal/app/wwctl/kernel/list/main.go +++ b/internal/app/wwctl/kernel/list/main.go @@ -26,7 +26,7 @@ func CobraRunE(cmd *cobra.Command, args []string) error { nodemap[n.KernelVersion.Get()]++ } - fmt.Printf("%-35s %-6s\n", "VNFS NAME", "NODE#") + fmt.Printf("%-35s %-6s\n", "VNFS NAME", "NODES") for _, k := range kernels { fmt.Printf("%-35s %6d\n", k, nodemap[k]) } From 73ed7d189134bf29a2dd38f4d8d969f01be383b5 Mon Sep 17 00:00:00 2001 From: Gregory Kurtzer Date: Fri, 20 Aug 2021 19:40:24 -0700 Subject: [PATCH 03/11] Another method to "unset" a configuration --- internal/pkg/node/methods.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/pkg/node/methods.go b/internal/pkg/node/methods.go index 63e5c972..a050695c 100644 --- a/internal/pkg/node/methods.go +++ b/internal/pkg/node/methods.go @@ -38,7 +38,7 @@ func (ent *Entry) Set(val string) { return } - if val == "UNDEF" || val == "DELETE" || val == "UNSET" { + if val == "UNDEF" || val == "DELETE" || val == "UNSET" || val == "--" { ent.value = "" } else { ent.value = val From 4d37c87c7bbc89e109b7d0278026ffce7b894132 Mon Sep 17 00:00:00 2001 From: Gregory Kurtzer Date: Fri, 20 Aug 2021 19:44:44 -0700 Subject: [PATCH 04/11] Add a note on help output of how to unset configs --- internal/app/wwctl/node/set/root.go | 9 +++++---- internal/app/wwctl/profile/set/root.go | 7 ++++--- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/internal/app/wwctl/node/set/root.go b/internal/app/wwctl/node/set/root.go index fe41253a..e4c84d24 100644 --- a/internal/app/wwctl/node/set/root.go +++ b/internal/app/wwctl/node/set/root.go @@ -6,9 +6,10 @@ var ( baseCmd = &cobra.Command{ Use: "set [flags] [node pattern]...", Short: "Configure node properties", - Long: "This command will allow you to set configuration properties for nodes.", - Args: cobra.MinimumNArgs(1), - RunE: CobraRunE, + Long: "This command will allow you to set configuration properties for nodes.\n\n" + + "Note: use the string 'UNSET' to remove a configuration", + Args: cobra.MinimumNArgs(1), + RunE: CobraRunE, } SetComment string SetContainer string @@ -31,7 +32,7 @@ var ( SetIpmiGateway string SetIpmiUsername string SetIpmiPassword string - SetIpmiInterface string + SetIpmiInterface string SetNodeAll bool SetYes bool SetProfile string diff --git a/internal/app/wwctl/profile/set/root.go b/internal/app/wwctl/profile/set/root.go index cf152aa8..019ea904 100644 --- a/internal/app/wwctl/profile/set/root.go +++ b/internal/app/wwctl/profile/set/root.go @@ -6,9 +6,10 @@ var ( baseCmd = &cobra.Command{ Use: "set [flags] ...", Short: "Configure node profile properties", - Long: "This command will allow you to set configuration properties for node profiles.", - Args: cobra.MinimumNArgs(1), - RunE: CobraRunE, + Long: "This command will allow you to set configuration properties for node profiles.\n\n" + + "Note: use the string 'UNSET' to remove a configuration", + Args: cobra.MinimumNArgs(1), + RunE: CobraRunE, } SetAll bool SetYes bool From a82e1b0ea5e23ad879b6e5fcecf045df38c9c9c8 Mon Sep 17 00:00:00 2001 From: Gregory Kurtzer Date: Sat, 21 Aug 2021 08:04:47 -0700 Subject: [PATCH 05/11] Fixed formatting across entire project --- cmd/bash_completion/bash_completion.go | 2 +- cmd/man_page/man_page.go | 6 +++--- cmd/wwctl/main.go | 1 - internal/app/wwctl/container/exec/child/main.go | 1 + .../app/wwctl/container/exec/child/non-Linux.go | 1 + internal/app/wwctl/container/exec/main.go | 1 + internal/app/wwctl/container/exec/non-linux.go | 1 + internal/app/wwctl/node/add/main.go | 14 +++++++------- internal/app/wwctl/node/delete/root.go | 4 ++-- internal/app/wwctl/node/list/main.go | 1 - internal/app/wwctl/node/sensors/power.go | 2 +- internal/app/wwctl/overlay/list/main.go | 2 +- internal/app/wwctl/power/cycle/power.go | 2 +- internal/app/wwctl/power/on/power.go | 2 +- internal/app/wwctl/power/status/power.go | 2 +- internal/app/wwctl/root.go | 10 +++++----- internal/pkg/node/datastructure.go | 6 +++--- internal/pkg/node/modifiers.go | 2 +- internal/pkg/power/ipmitool.go | 16 ++++++++-------- internal/pkg/warewulfconf/datastructure.go | 5 ++--- 20 files changed, 41 insertions(+), 40 deletions(-) diff --git a/cmd/bash_completion/bash_completion.go b/cmd/bash_completion/bash_completion.go index 2a300c87..752884bc 100644 --- a/cmd/bash_completion/bash_completion.go +++ b/cmd/bash_completion/bash_completion.go @@ -3,8 +3,8 @@ package main import ( "fmt" - "os" "github.com/hpcng/warewulf/internal/app/wwctl" + "os" ) func main() { diff --git a/cmd/man_page/man_page.go b/cmd/man_page/man_page.go index 45d42416..369026fa 100644 --- a/cmd/man_page/man_page.go +++ b/cmd/man_page/man_page.go @@ -2,13 +2,13 @@ package main import ( - "fmt" - "os" + "fmt" "github.com/hpcng/warewulf/internal/app/wwctl" + "os" ) func main() { - + if err := wwctl.GenManTree(os.Args[1]); err != nil { fmt.Println(err) return diff --git a/cmd/wwctl/main.go b/cmd/wwctl/main.go index e1e0f479..0676131e 100644 --- a/cmd/wwctl/main.go +++ b/cmd/wwctl/main.go @@ -9,4 +9,3 @@ func main() { root.Execute() } - diff --git a/internal/app/wwctl/container/exec/child/main.go b/internal/app/wwctl/container/exec/child/main.go index a7a16fde..05f1e439 100644 --- a/internal/app/wwctl/container/exec/child/main.go +++ b/internal/app/wwctl/container/exec/child/main.go @@ -1,3 +1,4 @@ +//go:build linux // +build linux package child diff --git a/internal/app/wwctl/container/exec/child/non-Linux.go b/internal/app/wwctl/container/exec/child/non-Linux.go index c8cc1725..96a4a9c7 100644 --- a/internal/app/wwctl/container/exec/child/non-Linux.go +++ b/internal/app/wwctl/container/exec/child/non-Linux.go @@ -1,3 +1,4 @@ +//go:build !linux // +build !linux package child diff --git a/internal/app/wwctl/container/exec/main.go b/internal/app/wwctl/container/exec/main.go index 1ad9ff03..2eb15a7b 100644 --- a/internal/app/wwctl/container/exec/main.go +++ b/internal/app/wwctl/container/exec/main.go @@ -1,3 +1,4 @@ +//go:build linux // +build linux package exec diff --git a/internal/app/wwctl/container/exec/non-linux.go b/internal/app/wwctl/container/exec/non-linux.go index a391ec15..5a869192 100644 --- a/internal/app/wwctl/container/exec/non-linux.go +++ b/internal/app/wwctl/container/exec/non-linux.go @@ -1,3 +1,4 @@ +//go:build !linux // +build !linux package exec diff --git a/internal/app/wwctl/node/add/main.go b/internal/app/wwctl/node/add/main.go index ab76b24a..5bda845a 100644 --- a/internal/app/wwctl/node/add/main.go +++ b/internal/app/wwctl/node/add/main.go @@ -24,15 +24,15 @@ func CobraRunE(cmd *cobra.Command, args []string) error { } fmt.Printf("Added node: %s\n", a) - if SetClusterName != "" { - wwlog.Printf(wwlog.VERBOSE, "Node: %s, Setting cluster name to: %s\n", n.Id.Get(), SetClusterName) - n.ClusterName.Set(SetClusterName) + if SetClusterName != "" { + wwlog.Printf(wwlog.VERBOSE, "Node: %s, Setting cluster name to: %s\n", n.Id.Get(), SetClusterName) + n.ClusterName.Set(SetClusterName) err := nodeDB.NodeUpdate(n) if err != nil { - wwlog.Printf(wwlog.ERROR, "%s\n", err) - os.Exit(1) - } - } + wwlog.Printf(wwlog.ERROR, "%s\n", err) + os.Exit(1) + } + } if SetIpaddr != "" { if SetNetDev == "" { diff --git a/internal/app/wwctl/node/delete/root.go b/internal/app/wwctl/node/delete/root.go index 868ad862..c7aa4840 100644 --- a/internal/app/wwctl/node/delete/root.go +++ b/internal/app/wwctl/node/delete/root.go @@ -11,8 +11,8 @@ var ( RunE: CobraRunE, Aliases: []string{"rm", "del"}, } - SetYes bool - SetForce string + SetYes bool + SetForce string ) func init() { diff --git a/internal/app/wwctl/node/list/main.go b/internal/app/wwctl/node/list/main.go index a11063e8..996d656c 100644 --- a/internal/app/wwctl/node/list/main.go +++ b/internal/app/wwctl/node/list/main.go @@ -51,7 +51,6 @@ func CobraRunE(cmd *cobra.Command, args []string) error { fmt.Printf("%-20s %-18s %-12s %s\n", node.Id.Get(), "IpmiUserName", node.IpmiUserName.Source(), node.IpmiUserName.Print()) fmt.Printf("%-20s %-18s %-12s %s\n", node.Id.Get(), "IpmiInterface", node.IpmiInterface.Source(), node.IpmiInterface.Print()) - for name, netdev := range node.NetDevs { fmt.Printf("%-20s %-18s %-12s %s\n", node.Id.Get(), name+":HWADDR", netdev.Hwaddr.Source(), netdev.Hwaddr.Print()) fmt.Printf("%-20s %-18s %-12s %s\n", node.Id.Get(), name+":IPADDR", netdev.Ipaddr.Source(), netdev.Ipaddr.Print()) diff --git a/internal/app/wwctl/node/sensors/power.go b/internal/app/wwctl/node/sensors/power.go index 3f1dad88..96813079 100644 --- a/internal/app/wwctl/node/sensors/power.go +++ b/internal/app/wwctl/node/sensors/power.go @@ -58,7 +58,7 @@ func CobraRunE(cmd *cobra.Command, args []string) error { User: node.IpmiUserName.Get(), Password: node.IpmiPassword.Get(), Interface: ipmiInterface, - AuthType: "MD5", + AuthType: "MD5", } fullFlag := full diff --git a/internal/app/wwctl/overlay/list/main.go b/internal/app/wwctl/overlay/list/main.go index cc8e8847..76929b87 100644 --- a/internal/app/wwctl/overlay/list/main.go +++ b/internal/app/wwctl/overlay/list/main.go @@ -117,7 +117,7 @@ func CobraRunE(cmd *cobra.Command, args []string) error { } var unconfigured bool - for overlay, _ := range set { + for overlay := range set { var overlayPath string if SystemOverlay == true { diff --git a/internal/app/wwctl/power/cycle/power.go b/internal/app/wwctl/power/cycle/power.go index b76aebc9..016e9a4f 100644 --- a/internal/app/wwctl/power/cycle/power.go +++ b/internal/app/wwctl/power/cycle/power.go @@ -58,7 +58,7 @@ func CobraRunE(cmd *cobra.Command, args []string) error { User: node.IpmiUserName.Get(), Password: node.IpmiPassword.Get(), Interface: ipmiInterface, - AuthType: "MD5", + AuthType: "MD5", } batchpool.Submit(func() { diff --git a/internal/app/wwctl/power/on/power.go b/internal/app/wwctl/power/on/power.go index 013d1dbc..a8c01f94 100644 --- a/internal/app/wwctl/power/on/power.go +++ b/internal/app/wwctl/power/on/power.go @@ -58,7 +58,7 @@ func CobraRunE(cmd *cobra.Command, args []string) error { User: node.IpmiUserName.Get(), Password: node.IpmiPassword.Get(), Interface: ipmiInterface, - AuthType: "MD5", + AuthType: "MD5", } batchpool.Submit(func() { diff --git a/internal/app/wwctl/power/status/power.go b/internal/app/wwctl/power/status/power.go index 98ecdf37..62e0698d 100644 --- a/internal/app/wwctl/power/status/power.go +++ b/internal/app/wwctl/power/status/power.go @@ -58,7 +58,7 @@ func CobraRunE(cmd *cobra.Command, args []string) error { User: node.IpmiUserName.Get(), Password: node.IpmiPassword.Get(), Interface: ipmiInterface, - AuthType: "MD5", + AuthType: "MD5", } batchpool.Submit(func() { diff --git a/internal/app/wwctl/root.go b/internal/app/wwctl/root.go index c6d9023c..4ee65b88 100644 --- a/internal/app/wwctl/root.go +++ b/internal/app/wwctl/root.go @@ -1,7 +1,6 @@ package wwctl import ( - "io" "github.com/hpcng/warewulf/internal/app/wwctl/configure" "github.com/hpcng/warewulf/internal/app/wwctl/container" "github.com/hpcng/warewulf/internal/app/wwctl/kernel" @@ -14,6 +13,7 @@ import ( "github.com/hpcng/warewulf/internal/pkg/wwlog" "github.com/spf13/cobra" "github.com/spf13/cobra/doc" + "io" ) var ( @@ -64,13 +64,13 @@ func rootPersistentPreRunE(cmd *cobra.Command, args []string) error { // GenBashCompletionFile func GenBashCompletion(w io.Writer) error { - return rootCmd.GenBashCompletion(w) + return rootCmd.GenBashCompletion(w) } -func GenManTree(fileName string) error{ +func GenManTree(fileName string) error { header := &doc.GenManHeader{ - Title: "MINE", + Title: "MINE", Section: "1", } - return doc.GenManTree(rootCmd,header,fileName) + return doc.GenManTree(rootCmd, header, fileName) } diff --git a/internal/pkg/node/datastructure.go b/internal/pkg/node/datastructure.go index c20083e0..738277a9 100644 --- a/internal/pkg/node/datastructure.go +++ b/internal/pkg/node/datastructure.go @@ -29,7 +29,7 @@ type NodeConf struct { IpmiIpaddr string `yaml:"ipmi ipaddr,omitempty"` IpmiNetmask string `yaml:"ipmi netmask,omitempty"` IpmiGateway string `yaml:"ipmi gateway,omitempty"` - IpmiInterface string `yaml:"ipmi interface,omitempty"` + IpmiInterface string `yaml:"ipmi interface,omitempty"` RuntimeOverlay string `yaml:"runtime overlay,omitempty"` SystemOverlay string `yaml:"system overlay,omitempty"` Init string `yaml:"init,omitempty"` @@ -107,8 +107,8 @@ func init() { c, err := os.OpenFile(ConfigFile, os.O_RDWR|os.O_CREATE, 0644) if err != nil { wwlog.Printf(wwlog.ERROR, "Could not create new configuration file: %s\n", err) - // just return silently, as init is also called for bash_completion - return + // just return silently, as init is also called for bash_completion + return } fmt.Fprintf(c, "nodeprofiles:\n") diff --git a/internal/pkg/node/modifiers.go b/internal/pkg/node/modifiers.go index 1c6e42ac..0260d598 100644 --- a/internal/pkg/node/modifiers.go +++ b/internal/pkg/node/modifiers.go @@ -159,7 +159,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].Keys = make(map[string]string) for devname, netdev := range profile.NetDevs { diff --git a/internal/pkg/power/ipmitool.go b/internal/pkg/power/ipmitool.go index 4ef21882..5c70c11b 100644 --- a/internal/pkg/power/ipmitool.go +++ b/internal/pkg/power/ipmitool.go @@ -16,8 +16,8 @@ type IPMI struct { User string Password string AuthType string - Interface string - result IPMIResult + Interface string + result IPMIResult } func (ipmi *IPMI) Result() (string, error) { @@ -28,9 +28,9 @@ func (ipmi *IPMI) Command(ipmiArgs []string) ([]byte, error) { var args []string - if ipmi.Interface == "" { - ipmi.Interface = "lanplus" - } + if ipmi.Interface == "" { + ipmi.Interface = "lanplus" + } args = append(args, "-I", ipmi.Interface, "-H", ipmi.HostName, "-U", ipmi.User, "-P", ipmi.Password) args = append(args, ipmiArgs...) ipmiCmd := exec.Command("ipmitool", args...) @@ -41,9 +41,9 @@ func (ipmi *IPMI) InteractiveCommand(ipmiArgs []string) error { var args []string - if ipmi.Interface == "" { - ipmi.Interface = "lan" - } + if ipmi.Interface == "" { + ipmi.Interface = "lan" + } args = append(args, "-I", ipmi.Interface, "-H", ipmi.HostName, "-U", ipmi.User, "-P", ipmi.Password) args = append(args, ipmiArgs...) diff --git a/internal/pkg/warewulfconf/datastructure.go b/internal/pkg/warewulfconf/datastructure.go index c47a08d8..694101ad 100644 --- a/internal/pkg/warewulfconf/datastructure.go +++ b/internal/pkg/warewulfconf/datastructure.go @@ -1,7 +1,6 @@ package warewulfconf import ( - "github.com/hpcng/warewulf/internal/pkg/util" "github.com/hpcng/warewulf/internal/pkg/wwlog" ) @@ -51,7 +50,7 @@ func init() { //TODO: Check to make sure nodes.conf is found if util.IsFile(ConfigFile) == false { wwlog.Printf(wwlog.ERROR, "Configuration file not found: %s\n", ConfigFile) - // fail silently as this also called by bash_completion - return + // fail silently as this also called by bash_completion + return } } From e6009bcd0c6c3e346ab63263d1b16feba681ed77 Mon Sep 17 00:00:00 2001 From: Gregory Kurtzer Date: Sat, 21 Aug 2021 08:14:41 -0700 Subject: [PATCH 06/11] Don't run systemctl when doing a make install (RPM fixes) --- Makefile | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 172bdccc..8657f75b 100644 --- a/Makefile +++ b/Makefile @@ -74,12 +74,10 @@ files: all install -c -m 0644 include/firewalld/warewulf.xml $(DESTDIR)/usr/lib/firewalld/services mkdir -p $(DESTDIR)/usr/lib/systemd/system install -c -m 0644 include/systemd/warewulfd.service $(DESTDIR)/usr/lib/systemd/system - systemctl daemon-reload ./bash_completion $(DESTDIR)/etc/bash_completion.d/warewulf ./man_page $(DESTDIR)/usr/share/man/man1 gzip --force $(DESTDIR)/usr/share/man/man1/wwctl*1 - - +# systemctl daemon-reload # cp -r tftpboot/* /var/lib/tftpboot/warewulf/ipxe/ # restorecon -r /var/lib/tftpboot/warewulf From fb7d81d6d1efe69b1be01d31166694fd616e4f51 Mon Sep 17 00:00:00 2001 From: Gregory Kurtzer Date: Sat, 21 Aug 2021 08:23:04 -0700 Subject: [PATCH 07/11] Include unpackaged files in the RPM SPEC --- warewulf.spec.in | 2 ++ 1 file changed, 2 insertions(+) diff --git a/warewulf.spec.in b/warewulf.spec.in index f5802933..ecd58bab 100644 --- a/warewulf.spec.in +++ b/warewulf.spec.in @@ -39,10 +39,12 @@ rm -rf $RPM_BUILD_ROOT %defattr(-, root, root) %attr(0755, root, warewulf) %dir /etc/warewulf/ %config(noreplace) /etc/warewulf/* +/etc/bash_completion.d/warewulf /usr/bin/wwctl /usr/lib/firewalld/services/warewulf.xml /usr/lib/systemd/system/warewulfd.service /var/warewulf +/usr/share/man/man1/* %changelog * Tue Jan 26 2021 14:46:24 JST Brian Clemens - 4.0.0 From 341f9f37c049567f7c8e7b858ecc6bb7978781c2 Mon Sep 17 00:00:00 2001 From: Gregory Kurtzer Date: Sat, 21 Aug 2021 08:25:21 -0700 Subject: [PATCH 08/11] Remove execute bit from config files --- overlays/system/default/etc/network/interfaces.d/eth0.ww | 0 .../system/default/etc/systemd/network/10-persistent-net.link.ww | 0 2 files changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 overlays/system/default/etc/network/interfaces.d/eth0.ww mode change 100755 => 100644 overlays/system/default/etc/systemd/network/10-persistent-net.link.ww diff --git a/overlays/system/default/etc/network/interfaces.d/eth0.ww b/overlays/system/default/etc/network/interfaces.d/eth0.ww old mode 100755 new mode 100644 diff --git a/overlays/system/default/etc/systemd/network/10-persistent-net.link.ww b/overlays/system/default/etc/systemd/network/10-persistent-net.link.ww old mode 100755 new mode 100644 From 2d1bd17d93e24e884c491a20b198b3f82a75ccf2 Mon Sep 17 00:00:00 2001 From: Gregory Kurtzer Date: Sun, 22 Aug 2021 07:28:49 -0700 Subject: [PATCH 09/11] Add dependencies to RPM SPEC --- warewulf.spec.in | 3 +++ 1 file changed, 3 insertions(+) diff --git a/warewulf.spec.in b/warewulf.spec.in index ecd58bab..cb481650 100644 --- a/warewulf.spec.in +++ b/warewulf.spec.in @@ -9,6 +9,9 @@ Group: System Environment/Clustering Source: %{name}-%{version}.tar.gz ExclusiveOS: linux BuildRoot: %{?_tmppath}/%{name}-%{version}-%{release}-root +Requires: dhcp-server +Requires: tftp-server +Requires: nfs-utils %description Warewulf is a bare metal container provisioning system. From 64fa482c64a18de0f9c83a967e30bf57824be7cc Mon Sep 17 00:00:00 2001 From: Gregory Kurtzer Date: Sun, 22 Aug 2021 08:47:51 -0700 Subject: [PATCH 10/11] Moved `ready` command to `node ready` --- internal/app/wwctl/node/list/main.go | 4 +- internal/app/wwctl/node/root.go | 2 + internal/app/wwctl/ready/main.go | 100 --------------------------- internal/app/wwctl/ready/root.go | 18 ----- internal/app/wwctl/root.go | 6 +- 5 files changed, 5 insertions(+), 125 deletions(-) delete mode 100644 internal/app/wwctl/ready/main.go delete mode 100644 internal/app/wwctl/ready/root.go diff --git a/internal/app/wwctl/node/list/main.go b/internal/app/wwctl/node/list/main.go index 996d656c..1953fac2 100644 --- a/internal/app/wwctl/node/list/main.go +++ b/internal/app/wwctl/node/list/main.go @@ -80,11 +80,11 @@ func CobraRunE(cmd *cobra.Command, args []string) error { } } else if ShowIpmi { - fmt.Printf("%-22s %-16s %-20s %-20s\n", "NODE NAME", "IPMI IPADDR", "IPMI USERNAME", "IPMI PASSWORD IPMI INTERFACE") + fmt.Printf("%-22s %-16s %-20s %-20s %-20s\n", "NODE NAME", "IPMI IPADDR", "IPMI USERNAME", "IPMI PASSWORD", "IPMI INTERFACE") fmt.Println(strings.Repeat("=", 80)) for _, node := range node.FilterByName(nodes, args) { - fmt.Printf("%-22s %-16s %-20s %-20s\n", node.Id.Get(), node.IpmiIpaddr.Print(), node.IpmiUserName.Print(), node.IpmiPassword.Print(), node.IpmiInterface.Print()) + fmt.Printf("%-22s %-16s %-20s %-20s %-20s\n", node.Id.Get(), node.IpmiIpaddr.Print(), node.IpmiUserName.Print(), node.IpmiPassword.Print(), node.IpmiInterface.Print()) } } else if ShowLong { diff --git a/internal/app/wwctl/node/root.go b/internal/app/wwctl/node/root.go index 64d693e0..c5c92ca4 100644 --- a/internal/app/wwctl/node/root.go +++ b/internal/app/wwctl/node/root.go @@ -5,6 +5,7 @@ import ( "github.com/hpcng/warewulf/internal/app/wwctl/node/console" "github.com/hpcng/warewulf/internal/app/wwctl/node/delete" "github.com/hpcng/warewulf/internal/app/wwctl/node/list" + "github.com/hpcng/warewulf/internal/app/wwctl/node/ready" "github.com/hpcng/warewulf/internal/app/wwctl/node/sensors" "github.com/hpcng/warewulf/internal/app/wwctl/node/set" "github.com/spf13/cobra" @@ -25,6 +26,7 @@ func init() { baseCmd.AddCommand(add.GetCommand()) baseCmd.AddCommand(delete.GetCommand()) baseCmd.AddCommand(console.GetCommand()) + baseCmd.AddCommand(ready.GetCommand()) } // GetRootCommand returns the root cobra.Command for the application. diff --git a/internal/app/wwctl/ready/main.go b/internal/app/wwctl/ready/main.go deleted file mode 100644 index f77481f4..00000000 --- a/internal/app/wwctl/ready/main.go +++ /dev/null @@ -1,100 +0,0 @@ -package ready - -import ( - "fmt" - "os" - - "github.com/hpcng/warewulf/internal/pkg/config" - "github.com/hpcng/warewulf/internal/pkg/container" - "github.com/hpcng/warewulf/internal/pkg/kernel" - "github.com/hpcng/warewulf/internal/pkg/node" - "github.com/hpcng/warewulf/internal/pkg/util" - "github.com/hpcng/warewulf/internal/pkg/wwlog" - "github.com/spf13/cobra" -) - -func CobraRunE(cmd *cobra.Command, args []string) error { - - n, err := node.New() - if err != nil { - wwlog.Printf(wwlog.ERROR, "Could not open node configuration: %s\n", err) - os.Exit(1) - } - - nodes, err := n.FindAllNodes() - if err != nil { - wwlog.Printf(wwlog.ERROR, "Cloud not get nodeList: %s\n", err) - os.Exit(1) - } - - fmt.Printf("%-25s %-10s %-6s %-6s %-6s %-6s %-6s\n", "NODE NAME", "READY", "VNFS", "KERNEL", "KMODS", "SYS-OL", "RUN-OL") - - for _, node := range nodes { - var vnfs_good bool - var kernel_good bool - var kmods_good bool - var systemo_good bool - var runtimeo_good bool - ready := true - - if node.ContainerName.Get() != "" { - vnfsImage := container.ImageFile(node.ContainerName.Get()) - - if util.IsFile(vnfsImage) == true { - vnfs_good = true - } else { - ready = false - wwlog.Printf(wwlog.VERBOSE, "VNFS not found: %s, %s\n", node.Id.Get(), vnfsImage) - } - } else { - ready = false - wwlog.Printf(wwlog.VERBOSE, "Node Kernel not defined: %s\n", node.Id.Get()) - } - - if node.KernelVersion.Get() != "" { - if util.IsFile(kernel.KernelImage(node.KernelVersion.Get())) == true { - kernel_good = true - } else { - ready = false - wwlog.Printf(wwlog.VERBOSE, "Node Kernel not found: %s, %s\n", node.Id.Get(), node.KernelVersion.Get()) - } - if util.IsFile(kernel.KmodsImage(node.KernelVersion.Get())) == true { - kmods_good = true - } else { - ready = false - wwlog.Printf(wwlog.VERBOSE, "Node Kmods not found: %s, %s\n", node.Id.Get(), node.KernelVersion.Get()) - } - } else { - ready = false - wwlog.Printf(wwlog.VERBOSE, "Node Kernel version not defined: %s\n", node.Id.Get()) - } - - if node.SystemOverlay.Get() != "" { - if util.IsFile(config.SystemOverlayImage(node.Id.Get())) == true { - systemo_good = true - } else { - ready = false - wwlog.Printf(wwlog.VERBOSE, "System Overlay not found: %s\n", config.SystemOverlayImage(node.Id.Get())) - } - } else { - ready = false - wwlog.Printf(wwlog.VERBOSE, "System Overlay not defined: %s\n", node.Id.Get()) - } - - if node.RuntimeOverlay.Get() != "" { - if util.IsFile(config.RuntimeOverlayImage(node.Id.Get())) == true { - runtimeo_good = true - } else { - ready = false - wwlog.Printf(wwlog.VERBOSE, "Runtime Overlay not found: %s\n", config.RuntimeOverlaySource(node.Id.Get())) - } - } else { - ready = false - wwlog.Printf(wwlog.VERBOSE, "Runtime Overlay not defined: %s\n", node.Id.Get()) - } - - fmt.Printf("%-25s %-10t %-6t %-6t %-6t %-6t %-6t\n", node.Id.Get(), ready, vnfs_good, kernel_good, kmods_good, systemo_good, runtimeo_good) - } - - return nil -} diff --git a/internal/app/wwctl/ready/root.go b/internal/app/wwctl/ready/root.go deleted file mode 100644 index b8c5bad6..00000000 --- a/internal/app/wwctl/ready/root.go +++ /dev/null @@ -1,18 +0,0 @@ -package ready - -import ( - "github.com/spf13/cobra" -) - -var ( - baseCmd = &cobra.Command{ - Use: "ready", - Short: "Warewulf Status Check", - RunE: CobraRunE, - } -) - -// GetRootCommand returns the root cobra.Command for the application. -func GetCommand() *cobra.Command { - return baseCmd -} diff --git a/internal/app/wwctl/root.go b/internal/app/wwctl/root.go index 4ee65b88..452a1240 100644 --- a/internal/app/wwctl/root.go +++ b/internal/app/wwctl/root.go @@ -8,11 +8,11 @@ import ( "github.com/hpcng/warewulf/internal/app/wwctl/overlay" "github.com/hpcng/warewulf/internal/app/wwctl/power" "github.com/hpcng/warewulf/internal/app/wwctl/profile" - "github.com/hpcng/warewulf/internal/app/wwctl/ready" "github.com/hpcng/warewulf/internal/app/wwctl/server" "github.com/hpcng/warewulf/internal/pkg/wwlog" "github.com/spf13/cobra" "github.com/spf13/cobra/doc" + "io" ) @@ -31,17 +31,13 @@ func init() { rootCmd.PersistentFlags().BoolVarP(&verboseArg, "verbose", "v", false, "Run with increased verbosity.") rootCmd.PersistentFlags().BoolVarP(&debugArg, "debug", "d", false, "Run with debugging messages enabled.") - //rootCmd.AddCommand(build.GetCommand()) - rootCmd.AddCommand(overlay.GetCommand()) - // rootCmd.AddCommand(controller.GetCommand()) rootCmd.AddCommand(container.GetCommand()) rootCmd.AddCommand(node.GetCommand()) rootCmd.AddCommand(kernel.GetCommand()) rootCmd.AddCommand(power.GetCommand()) rootCmd.AddCommand(profile.GetCommand()) rootCmd.AddCommand(configure.GetCommand()) - rootCmd.AddCommand(ready.GetCommand()) rootCmd.AddCommand(server.GetCommand()) } From 3a090a713340f42b549675eb4206cb6361365734 Mon Sep 17 00:00:00 2001 From: Gregory Kurtzer Date: Sun, 22 Aug 2021 19:17:41 -0700 Subject: [PATCH 11/11] Fixed missing package after move of `ready` --- internal/app/wwctl/node/ready/main.go | 100 ++++++++++++++++++++++++++ internal/app/wwctl/node/ready/root.go | 18 +++++ 2 files changed, 118 insertions(+) create mode 100644 internal/app/wwctl/node/ready/main.go create mode 100644 internal/app/wwctl/node/ready/root.go diff --git a/internal/app/wwctl/node/ready/main.go b/internal/app/wwctl/node/ready/main.go new file mode 100644 index 00000000..2df4b33d --- /dev/null +++ b/internal/app/wwctl/node/ready/main.go @@ -0,0 +1,100 @@ +package ready + +import ( + "fmt" + "os" + + "github.com/hpcng/warewulf/internal/pkg/config" + "github.com/hpcng/warewulf/internal/pkg/container" + "github.com/hpcng/warewulf/internal/pkg/kernel" + "github.com/hpcng/warewulf/internal/pkg/node" + "github.com/hpcng/warewulf/internal/pkg/util" + "github.com/hpcng/warewulf/internal/pkg/wwlog" + "github.com/spf13/cobra" +) + +func CobraRunE(cmd *cobra.Command, args []string) error { + + n, err := node.New() + if err != nil { + wwlog.Printf(wwlog.ERROR, "Could not open node configuration: %s\n", err) + os.Exit(1) + } + + nodes, err := n.FindAllNodes() + if err != nil { + wwlog.Printf(wwlog.ERROR, "Cloud not get nodeList: %s\n", err) + os.Exit(1) + } + + fmt.Printf("%-25s %-10s %-6s %-6s %-6s %-6s %-6s\n", "NODE NAME", "STATUS", "VNFS", "KERNEL", "KMODS", "SYS-OL", "RUN-OL") + + for _, node := range nodes { + var vnfs_good bool + var kernel_good bool + var kmods_good bool + var systemo_good bool + var runtimeo_good bool + status := true + + if node.ContainerName.Get() != "" { + vnfsImage := container.ImageFile(node.ContainerName.Get()) + + if util.IsFile(vnfsImage) == true { + vnfs_good = true + } else { + status = false + wwlog.Printf(wwlog.VERBOSE, "VNFS not found: %s, %s\n", node.Id.Get(), vnfsImage) + } + } else { + status = false + wwlog.Printf(wwlog.VERBOSE, "Node Kernel not defined: %s\n", node.Id.Get()) + } + + if node.KernelVersion.Get() != "" { + if util.IsFile(kernel.KernelImage(node.KernelVersion.Get())) == true { + kernel_good = true + } else { + status = false + wwlog.Printf(wwlog.VERBOSE, "Node Kernel not found: %s, %s\n", node.Id.Get(), node.KernelVersion.Get()) + } + if util.IsFile(kernel.KmodsImage(node.KernelVersion.Get())) == true { + kmods_good = true + } else { + status = false + wwlog.Printf(wwlog.VERBOSE, "Node Kmods not found: %s, %s\n", node.Id.Get(), node.KernelVersion.Get()) + } + } else { + status = false + wwlog.Printf(wwlog.VERBOSE, "Node Kernel version not defined: %s\n", node.Id.Get()) + } + + if node.SystemOverlay.Get() != "" { + if util.IsFile(config.SystemOverlayImage(node.Id.Get())) == true { + systemo_good = true + } else { + status = false + wwlog.Printf(wwlog.VERBOSE, "System Overlay not found: %s\n", config.SystemOverlayImage(node.Id.Get())) + } + } else { + status = false + wwlog.Printf(wwlog.VERBOSE, "System Overlay not defined: %s\n", node.Id.Get()) + } + + if node.RuntimeOverlay.Get() != "" { + if util.IsFile(config.RuntimeOverlayImage(node.Id.Get())) == true { + runtimeo_good = true + } else { + status = false + wwlog.Printf(wwlog.VERBOSE, "Runtime Overlay not found: %s\n", config.RuntimeOverlaySource(node.Id.Get())) + } + } else { + status = false + wwlog.Printf(wwlog.VERBOSE, "Runtime Overlay not defined: %s\n", node.Id.Get()) + } + + fmt.Printf("%-25s %-10t %-6t %-6t %-6t %-6t %-6t\n", node.Id.Get(), status, vnfs_good, kernel_good, kmods_good, systemo_good, runtimeo_good) + } + + return nil +} diff --git a/internal/app/wwctl/node/ready/root.go b/internal/app/wwctl/node/ready/root.go new file mode 100644 index 00000000..b8c5bad6 --- /dev/null +++ b/internal/app/wwctl/node/ready/root.go @@ -0,0 +1,18 @@ +package ready + +import ( + "github.com/spf13/cobra" +) + +var ( + baseCmd = &cobra.Command{ + Use: "ready", + Short: "Warewulf Status Check", + RunE: CobraRunE, + } +) + +// GetRootCommand returns the root cobra.Command for the application. +func GetCommand() *cobra.Command { + return baseCmd +}