Merge branch 'main' into main
This commit is contained in:
2
Makefile
2
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)
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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())
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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)")
|
||||
|
||||
@@ -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())
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
|
||||
@@ -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")
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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"`
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user