diff --git a/Makefile b/Makefile index b57afee1..bdf59094 100644 --- a/Makefile +++ b/Makefile @@ -13,7 +13,7 @@ VARLIST := OS VARLIST += WAREWULF VERSION RELEASE WAREWULF ?= warewulf VERSION ?= 4.3.0rc2 -GIT_TAG := $(shell test -e .git && git describe --tags --long --first-parent --always) +GIT_TAG := $(shell test -e .git && git log -1 --format="%h") ifdef GIT_TAG ifdef $(filter $(OS),ubuntu debian) diff --git a/internal/app/wwctl/container/show/main.go b/internal/app/wwctl/container/show/main.go index a902eee2..30defabf 100644 --- a/internal/app/wwctl/container/show/main.go +++ b/internal/app/wwctl/container/show/main.go @@ -18,6 +18,11 @@ func CobraRunE(cmd *cobra.Command, args []string) error { } else { fmt.Printf("Name: %s\n", containerName) fmt.Printf("Rootfs: %s\n", container.RootFsDir(containerName)) + kernelVersion := container.KernelVersion(containerName) + if kernelVersion != "" { + kernelVersion = "not found" + fmt.Printf("Kernelversion: %s\n", kernelVersion) + } nodeDB, _ := node.New() nodes, _ := nodeDB.FindAllNodes() diff --git a/internal/app/wwctl/node/list/main.go b/internal/app/wwctl/node/list/main.go index dd83d7c7..75f06d34 100644 --- a/internal/app/wwctl/node/list/main.go +++ b/internal/app/wwctl/node/list/main.go @@ -56,7 +56,7 @@ func CobraRunE(cmd *cobra.Command, args []string) error { fmt.Printf("%-20s %-18s %-12s %s\n", node.Id.Get(), "IpmiGateway", node.Ipmi.Gateway.Source(), node.Ipmi.Gateway.Print()) fmt.Printf("%-20s %-18s %-12s %s\n", node.Id.Get(), "IpmiUserName", node.Ipmi.UserName.Source(), node.Ipmi.UserName.Print()) fmt.Printf("%-20s %-18s %-12s %s\n", node.Id.Get(), "IpmiInterface", node.Ipmi.Interface.Source(), node.Ipmi.Interface.Print()) - fmt.Printf("%-20s %-18s %-12s %s\n", node.Id.Get(), "IpmiWrite", node.Ipmi.Interface.Source(), node.Ipmi.Write.Print()) + fmt.Printf("%-20s %-18s %-12s %s\n", node.Id.Get(), "IpmiWrite", node.Ipmi.Interface.Source(), node.Ipmi.Write.PrintB()) for keyname, key := range node.Tags { fmt.Printf("%-20s %-18s %-12s %s\n", node.Id.Get(), "Tag["+keyname+"]", key.Source(), key.Print()) diff --git a/internal/app/wwctl/node/set/main.go b/internal/app/wwctl/node/set/main.go index c41900d8..6460313e 100644 --- a/internal/app/wwctl/node/set/main.go +++ b/internal/app/wwctl/node/set/main.go @@ -289,10 +289,10 @@ func CobraRunE(cmd *cobra.Command, args []string) error { n.Default.SetB(false) } - wwlog.Printf(wwlog.VERBOSE, "Node: %s:%s, Setting DEFAULT\n", n.Id.Get(), SetNetName) + wwlog.Printf(wwlog.VERBOSE, "Node: %s:%s, Setting PRIMARY\n", n.Id.Get(), SetNetName) n.NetDevs[SetNetName].Default.SetB(true) } else { - wwlog.Printf(wwlog.VERBOSE, "Node: %s:%s, Unsetting DEFAULT\n", n.Id.Get(), SetNetName) + wwlog.Printf(wwlog.VERBOSE, "Node: %s:%s, Unsetting PRIMARY\n", n.Id.Get(), SetNetName) n.NetDevs[SetNetName].Default.SetB(false) } } diff --git a/internal/app/wwctl/node/set/root.go b/internal/app/wwctl/node/set/root.go index 1470cafb..d6eb7bf7 100644 --- a/internal/app/wwctl/node/set/root.go +++ b/internal/app/wwctl/node/set/root.go @@ -143,7 +143,7 @@ func init() { baseCmd.PersistentFlags().StringVarP(&SetHwaddr, "hwaddr", "H", "", "Set the node's network device HW address") baseCmd.PersistentFlags().StringVarP(&SetType, "type", "T", "", "Set the node's network device type") baseCmd.PersistentFlags().StringVar(&SetNetOnBoot, "onboot", "", "Enable/disable device (yes/no)") - baseCmd.PersistentFlags().StringVar(&SetNetDefault, "default", "", "Enable/disable device as default (yes/no)") + baseCmd.PersistentFlags().StringVar(&SetNetDefault, "primary", "", "Enable/disable device as primary (yes/no)") baseCmd.PersistentFlags().BoolVar(&SetNetDevDel, "netdel", false, "Delete the node's network device") baseCmd.PersistentFlags().StringSliceVar(&SetNetTags, "nettag", []string{}, "Define custom tag to network device (key=value)") diff --git a/internal/app/wwctl/profile/list/main.go b/internal/app/wwctl/profile/list/main.go index 4f4f5d4c..a5eecb85 100644 --- a/internal/app/wwctl/profile/list/main.go +++ b/internal/app/wwctl/profile/list/main.go @@ -32,6 +32,8 @@ func CobraRunE(cmd *cobra.Command, args []string) error { fmt.Printf("%-20s %-18s %s\n", profile.Id.Get(), "Comment", profile.Comment.Print()) fmt.Printf("%-20s %-18s %s\n", profile.Id.Get(), "Cluster", profile.ClusterName.Print()) + fmt.Printf("%-20s %-18s %s\n", profile.Id.Get(), "Discoverable", profile.Discoverable.PrintB()) + fmt.Printf("%-20s %-18s %s\n", profile.Id.Get(), "Container", profile.ContainerName.Print()) fmt.Printf("%-20s %-18s %s\n", profile.Id.Get(), "KernelOverride", profile.Kernel.Override.Print()) fmt.Printf("%-20s %-18s %s\n", profile.Id.Get(), "KernelArgs", profile.Kernel.Args.Print()) diff --git a/internal/app/wwctl/profile/set/main.go b/internal/app/wwctl/profile/set/main.go index 9ef58ee1..e217ed4c 100644 --- a/internal/app/wwctl/profile/set/main.go +++ b/internal/app/wwctl/profile/set/main.go @@ -219,15 +219,15 @@ func CobraRunE(cmd *cobra.Command, args []string) error { if SetNetDefault == "yes" || SetNetDefault == "y" || SetNetDefault == "1" || SetNetDefault == "true" { - // Set all other devices to non-default + // Set all other networks to non-default for _, n := range p.NetDevs { n.Default.SetB(false) } - wwlog.Printf(wwlog.VERBOSE, "Profile: %s:%s, Setting DEFAULT\n", p.Id.Get(), SetNetName) + wwlog.Printf(wwlog.VERBOSE, "Profile: %s:%s, Setting PRIMARY\n", p.Id.Get(), SetNetName) p.NetDevs[SetNetName].Default.SetB(true) } else { - wwlog.Printf(wwlog.VERBOSE, "Profile: %s:%s, Unsetting DEFAULT\n", p.Id.Get(), SetNetName) + wwlog.Printf(wwlog.VERBOSE, "Profile: %s:%s, Unsetting PRIMARY\n", p.Id.Get(), SetNetName) p.NetDevs[SetNetName].Default.SetB(false) } } @@ -239,11 +239,11 @@ func CobraRunE(cmd *cobra.Command, args []string) error { } if _, ok := p.NetDevs[SetNetName]; !ok { - wwlog.Printf(wwlog.ERROR, "Profile '%s': network Device doesn't exist: %s\n", p.Id.Get(), SetNetName) + wwlog.Printf(wwlog.ERROR, "Profile '%s': network name doesn't exist: %s\n", p.Id.Get(), SetNetName) os.Exit(1) } - wwlog.Printf(wwlog.VERBOSE, "Profile %s: Deleting network device: %s\n", p.Id.Get(), SetNetName) + wwlog.Printf(wwlog.VERBOSE, "Profile %s: Deleting network: %s\n", p.Id.Get(), SetNetName) delete(p.NetDevs, SetNetName) } diff --git a/internal/app/wwctl/profile/set/root.go b/internal/app/wwctl/profile/set/root.go index eb2a6b6e..e586314c 100644 --- a/internal/app/wwctl/profile/set/root.go +++ b/internal/app/wwctl/profile/set/root.go @@ -118,6 +118,7 @@ func init() { baseCmd.PersistentFlags().StringVarP(&SetNetName, "netname", "n", "default", "Define the network name to configure") baseCmd.PersistentFlags().StringVarP(&SetNetDev, "netdev", "N", "", "Set the node's network device") + baseCmd.PersistentFlags().StringVar(&SetNetDefault, "primary", "", "Enable/disable device as primary (yes/no)") baseCmd.PersistentFlags().StringVarP(&SetNetmask, "netmask", "M", "", "Set the node's network device netmask") baseCmd.PersistentFlags().StringVarP(&SetGateway, "gateway", "G", "", "Set the node's network device gateway") baseCmd.PersistentFlags().StringVarP(&SetType, "type", "T", "", "Set the node's network device type") diff --git a/internal/app/wwctl/version/main.go b/internal/app/wwctl/version/main.go index 08e48d09..17e446de 100644 --- a/internal/app/wwctl/version/main.go +++ b/internal/app/wwctl/version/main.go @@ -3,13 +3,29 @@ package version import ( "fmt" + "github.com/hpcng/warewulf/internal/pkg/buildconfig" "github.com/hpcng/warewulf/internal/pkg/version" "github.com/spf13/cobra" ) func CobraRunE(cmd *cobra.Command, args []string) error { - - fmt.Println("Version:\t", version.GetVersion()) - + if ListFull { + fmt.Printf("%s=%s\n", "VERSION", version.GetVersion()) + fmt.Printf("%s=%s\n", "BINDIR", buildconfig.BINDIR()) + fmt.Printf("%s=%s\n", "DATADIR", buildconfig.DATADIR()) + fmt.Printf("%s=%s\n", "SYSCONFDIR", buildconfig.SYSCONFDIR()) + fmt.Printf("%s=%s\n", "LOCALSTATEDIR", buildconfig.LOCALSTATEDIR()) + fmt.Printf("%s=%s\n", "SRVDIR", buildconfig.SRVDIR()) + fmt.Printf("%s=%s\n", "TFTPDIR", buildconfig.TFTPDIR()) + fmt.Printf("%s=%s\n", "SYSTEMDDIR", buildconfig.SYSTEMDDIR()) + fmt.Printf("%s=%s\n", "WWOVERLAYDIR", buildconfig.WWOVERLAYDIR()) + fmt.Printf("%s=%s\n", "WWCHROOTDIR", buildconfig.WWCHROOTDIR()) + fmt.Printf("%s=%s\n", "WWPROVISIONDIR", buildconfig.WWPROVISIONDIR()) + fmt.Printf("%s=%s\n", "BASEVERSION", buildconfig.VERSION()) + fmt.Printf("%s=%s\n", "RELEASE", buildconfig.RELEASE()) + fmt.Printf("%s=%s\n", "WWCLIENTDIR", buildconfig.WWCLIENTDIR()) + } else { + fmt.Println(version.GetVersion()) + } return nil } diff --git a/internal/app/wwctl/version/root.go b/internal/app/wwctl/version/root.go index 766d3b8f..4e88e9d9 100644 --- a/internal/app/wwctl/version/root.go +++ b/internal/app/wwctl/version/root.go @@ -11,9 +11,11 @@ var ( Args: cobra.ExactArgs(0), Aliases: []string{"vers"}, } + ListFull bool ) func init() { + baseCmd.PersistentFlags().BoolVarP(&ListFull, "full", "f", false, "List all compiled in variables.") } // GetRootCommand returns the root cobra.Command for the application. diff --git a/internal/pkg/node/datastructure.go b/internal/pkg/node/datastructure.go index 11f83c60..d78ee910 100644 --- a/internal/pkg/node/datastructure.go +++ b/internal/pkg/node/datastructure.go @@ -75,7 +75,7 @@ type NetDevs struct { Prefix string `yaml:"prefix,omitempty"` Netmask string `yaml:"netmask,omitempty"` Gateway string `yaml:"gateway,omitempty"` - Default string `yaml:"default,omitempty"` + Default string `yaml:"primary,omitempty"` Tags map[string]string `yaml:"tags,omitempty"` } diff --git a/internal/pkg/node/methods.go b/internal/pkg/node/methods.go index 20960b1c..2e0546af 100644 --- a/internal/pkg/node/methods.go +++ b/internal/pkg/node/methods.go @@ -68,6 +68,8 @@ Set bool func (ent *Entry) SetB(val bool) { if val { ent.value = []string{"true"} + } else { + ent.value = []string{"false"} } } @@ -100,6 +102,9 @@ func (ent *Entry) SetAltB(val bool, from string) { if val { ent.altvalue = []string{"true"} ent.from = from + } else { + ent.altvalue = []string{"false"} + ent.from = from } } diff --git a/warewulf.spec.in b/warewulf.spec.in index a4b2dbac..67d9261f 100644 --- a/warewulf.spec.in +++ b/warewulf.spec.in @@ -1,13 +1,12 @@ %define debug_package %{nil} -%if 0%{?sle_version} +%if 0%{?suse_version} %global tftpdir /srv/tftpboot -%global srvdir /srv %else # Assume Fedora-based OS if not SUSE-based %global tftpdir /var/lib/tftpboot -%global srvdir %{_sharedstatedir} %endif +%global srvdir %{_sharedstatedir} %global wwgroup warewulf @@ -30,12 +29,15 @@ Conflicts: warewulf-ipmi BuildRequires: make -%if 0%{?sle_version} +%if 0%{?suse_version} BuildRequires: systemd-rpm-macros BuildRequires: go BuildRequires: firewall-macros +BuildRequires: firewalld +BuildRequires: tftp Requires: tftp Requires: nfs-kernel-server +Requires: firewalld %else BuildRequires: systemd BuildRequires: golang @@ -44,7 +46,7 @@ Requires: tftp-server Requires: nfs-utils %endif -%if 0%{?rhel} >= 8 || 0%{?sle_version} +%if 0%{?rhel} >= 8 || 0%{?suse_version} Requires: dhcp-server %else # rhel < 8 @@ -82,6 +84,7 @@ make %install +export NO_BRP_STALE_LINK_ERROR=yes make install DESTDIR=%{buildroot} @@ -121,6 +124,7 @@ getent group %{wwgroup} >/dev/null || groupadd -r %{wwgroup} %attr(-, root, root) %{_mandir}/man1/wwctl* %attr(-, root, root) %{_datadir}/warewulf +%dir %{_docdir}/warewulf %license %{_docdir}/warewulf/LICENSE.md