Various fixes found in testing
This commit is contained in:
12
Makefile
12
Makefile
@@ -94,11 +94,13 @@ files: all
|
|||||||
cp -r etc/dhcp $(DESTDIR)/etc/warewulf/
|
cp -r etc/dhcp $(DESTDIR)/etc/warewulf/
|
||||||
cp -r etc/ipxe $(DESTDIR)/etc/warewulf/
|
cp -r etc/ipxe $(DESTDIR)/etc/warewulf/
|
||||||
cp -r overlays $(DESTDIR)/var/warewulf/
|
cp -r overlays $(DESTDIR)/var/warewulf/
|
||||||
chmod +x $(DESTDIR)/var/warewulf/overlays/system/default/init
|
mkdir -p $(DESTDIR)/var/warewulf/overlays/wwinit/bin/
|
||||||
chmod 600 $(DESTDIR)/var/warewulf/overlays/system/default/etc/ssh/ssh*
|
mkdir -p $(DESTDIR)/var/warewulf/overlays/wwinit/warewulf/bin/
|
||||||
chmod 644 $(DESTDIR)/var/warewulf/overlays/system/default/etc/ssh/ssh*.pub.ww
|
chmod +x $(DESTDIR)/var/warewulf/overlays/wwinit/init
|
||||||
mkdir -p $(DESTDIR)/var/warewulf/overlays/system/default/warewulf/bin/
|
chmod 600 $(DESTDIR)/var/warewulf/overlays/wwinit/etc/ssh/ssh*
|
||||||
cp wwctl $(DESTDIR)/usr/bin/
|
chmod 644 $(DESTDIR)/var/warewulf/overlays/wwinit/etc/ssh/ssh*.pub.ww
|
||||||
|
mkdir -p $(DESTDIR)/var/warewulf/overlays/wwinit/warewulf/bin/
|
||||||
|
install -m 0755 wwctl $(DESTDIR)/usr/bin/
|
||||||
mkdir -p $(DESTDIR)/usr/lib/firewalld/services
|
mkdir -p $(DESTDIR)/usr/lib/firewalld/services
|
||||||
install -c -m 0644 include/firewalld/warewulf.xml $(DESTDIR)/usr/lib/firewalld/services
|
install -c -m 0644 include/firewalld/warewulf.xml $(DESTDIR)/usr/lib/firewalld/services
|
||||||
mkdir -p $(DESTDIR)/usr/lib/systemd/system
|
mkdir -p $(DESTDIR)/usr/lib/systemd/system
|
||||||
|
|||||||
@@ -168,10 +168,15 @@ func CobraRunE(cmd *cobra.Command, args []string) error {
|
|||||||
if SetNetName != "" {
|
if SetNetName != "" {
|
||||||
if _, ok := n.NetDevs[SetNetName]; !ok {
|
if _, ok := n.NetDevs[SetNetName]; !ok {
|
||||||
var nd node.NetDevEntry
|
var nd node.NetDevEntry
|
||||||
n.NetDevs[SetNetName] = &nd
|
|
||||||
|
|
||||||
SetNetOnBoot = "yes"
|
SetNetOnBoot = "yes"
|
||||||
|
|
||||||
|
if len(n.NetDevs) == 0 {
|
||||||
|
SetNetDefault = "yes"
|
||||||
|
}
|
||||||
|
|
||||||
|
n.NetDevs[SetNetName] = &nd
|
||||||
|
|
||||||
if SetNetDev == "" {
|
if SetNetDev == "" {
|
||||||
n.NetDevs[SetNetName].Device.Set(SetNetName)
|
n.NetDevs[SetNetName].Device.Set(SetNetName)
|
||||||
}
|
}
|
||||||
@@ -255,6 +260,27 @@ func CobraRunE(cmd *cobra.Command, args []string) error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if SetNetDefault != "" {
|
||||||
|
if SetNetName == "" {
|
||||||
|
wwlog.Printf(wwlog.ERROR, "You must include the '--netname' option\n")
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
|
||||||
|
if SetNetDefault == "yes" || SetNetDefault == "y" || SetNetDefault == "1" || SetNetDefault == "true" {
|
||||||
|
|
||||||
|
// Set all other devices to non-default
|
||||||
|
for _, n := range n.NetDevs {
|
||||||
|
n.Default.SetB(false)
|
||||||
|
}
|
||||||
|
|
||||||
|
wwlog.Printf(wwlog.VERBOSE, "Node: %s:%s, Setting DEFAULT\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)
|
||||||
|
n.NetDevs[SetNetName].Default.SetB(false)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if SetNetDevDel {
|
if SetNetDevDel {
|
||||||
if SetNetName == "" {
|
if SetNetName == "" {
|
||||||
wwlog.Printf(wwlog.ERROR, "You must include the '--netname' option\n")
|
wwlog.Printf(wwlog.ERROR, "You must include the '--netname' option\n")
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ var (
|
|||||||
SetHwaddr string
|
SetHwaddr string
|
||||||
SetType string
|
SetType string
|
||||||
SetNetOnBoot string
|
SetNetOnBoot string
|
||||||
|
SetNetDefault string
|
||||||
SetNetDevDel bool
|
SetNetDevDel bool
|
||||||
SetClusterName string
|
SetClusterName string
|
||||||
SetIpxe string
|
SetIpxe string
|
||||||
@@ -138,6 +139,7 @@ func init() {
|
|||||||
baseCmd.PersistentFlags().StringVarP(&SetHwaddr, "hwaddr", "H", "", "Set the node's network device HW address")
|
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().StringVarP(&SetType, "type", "T", "", "Set the node's network device type")
|
||||||
baseCmd.PersistentFlags().StringVar(&SetNetOnBoot, "onboot", "", "Enable/disable device (yes/no)")
|
baseCmd.PersistentFlags().StringVar(&SetNetOnBoot, "onboot", "", "Enable/disable device (yes/no)")
|
||||||
|
baseCmd.PersistentFlags().StringVar(&SetNetDefault, "default", "", "Enable/disable device as default (yes/no)")
|
||||||
|
|
||||||
baseCmd.PersistentFlags().BoolVar(&SetNetDevDel, "netdel", false, "Delete the node's network device")
|
baseCmd.PersistentFlags().BoolVar(&SetNetDevDel, "netdel", false, "Delete the node's network device")
|
||||||
|
|
||||||
|
|||||||
@@ -138,10 +138,15 @@ func CobraRunE(cmd *cobra.Command, args []string) error {
|
|||||||
if SetNetName != "" {
|
if SetNetName != "" {
|
||||||
if _, ok := p.NetDevs[SetNetName]; !ok {
|
if _, ok := p.NetDevs[SetNetName]; !ok {
|
||||||
var nd node.NetDevEntry
|
var nd node.NetDevEntry
|
||||||
p.NetDevs[SetNetName] = &nd
|
|
||||||
|
|
||||||
SetNetOnBoot = "yes"
|
SetNetOnBoot = "yes"
|
||||||
|
|
||||||
|
if len(p.NetDevs) == 0 {
|
||||||
|
SetNetDefault = "yes"
|
||||||
|
}
|
||||||
|
|
||||||
|
p.NetDevs[SetNetName] = &nd
|
||||||
|
|
||||||
if SetNetDev == "" {
|
if SetNetDev == "" {
|
||||||
p.NetDevs[SetNetName].Device.Set(SetNetName)
|
p.NetDevs[SetNetName].Device.Set(SetNetName)
|
||||||
}
|
}
|
||||||
@@ -215,14 +220,35 @@ func CobraRunE(cmd *cobra.Command, args []string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if SetNetOnBoot == "yes" || SetNetOnBoot == "y" || SetNetOnBoot == "1" || SetNetOnBoot == "true" {
|
if SetNetOnBoot == "yes" || SetNetOnBoot == "y" || SetNetOnBoot == "1" || SetNetOnBoot == "true" {
|
||||||
wwlog.Printf(wwlog.VERBOSE, "Node: %s:%s, Setting ONBOOT\n", p.Id.Get(), SetNetName)
|
wwlog.Printf(wwlog.VERBOSE, "Profile: %s:%s, Setting ONBOOT\n", p.Id.Get(), SetNetName)
|
||||||
p.NetDevs[SetNetName].OnBoot.SetB(true)
|
p.NetDevs[SetNetName].OnBoot.SetB(true)
|
||||||
} else {
|
} else {
|
||||||
wwlog.Printf(wwlog.VERBOSE, "Node: %s:%s, Unsetting ONBOOT\n", p.Id.Get(), SetNetName)
|
wwlog.Printf(wwlog.VERBOSE, "Profile: %s:%s, Unsetting ONBOOT\n", p.Id.Get(), SetNetName)
|
||||||
p.NetDevs[SetNetName].OnBoot.SetB(false)
|
p.NetDevs[SetNetName].OnBoot.SetB(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if SetNetDefault != "" {
|
||||||
|
if SetNetName == "" {
|
||||||
|
wwlog.Printf(wwlog.ERROR, "You must include the '--netname' option\n")
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
|
||||||
|
if SetNetDefault == "yes" || SetNetDefault == "y" || SetNetDefault == "1" || SetNetDefault == "true" {
|
||||||
|
|
||||||
|
// Set all other devices 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)
|
||||||
|
p.NetDevs[SetNetName].Default.SetB(true)
|
||||||
|
} else {
|
||||||
|
wwlog.Printf(wwlog.VERBOSE, "Profile: %s:%s, Unsetting DEFAULT\n", p.Id.Get(), SetNetName)
|
||||||
|
p.NetDevs[SetNetName].Default.SetB(false)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if SetNetDevDel {
|
if SetNetDevDel {
|
||||||
if SetNetDev == "" {
|
if SetNetDev == "" {
|
||||||
wwlog.Printf(wwlog.ERROR, "You must include the '--netname' option\n")
|
wwlog.Printf(wwlog.ERROR, "You must include the '--netname' option\n")
|
||||||
|
|||||||
@@ -58,6 +58,7 @@ var (
|
|||||||
SetHwaddr string
|
SetHwaddr string
|
||||||
SetType string
|
SetType string
|
||||||
SetNetOnBoot string
|
SetNetOnBoot string
|
||||||
|
SetNetDefault string
|
||||||
SetNetDevDel bool
|
SetNetDevDel bool
|
||||||
SetDiscoverable bool
|
SetDiscoverable bool
|
||||||
SetUndiscoverable bool
|
SetUndiscoverable bool
|
||||||
@@ -121,6 +122,7 @@ func init() {
|
|||||||
baseCmd.PersistentFlags().StringVarP(&SetHwaddr, "hwaddr", "H", "", "Set the node's network device HW address")
|
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().StringVarP(&SetType, "type", "T", "", "Set the node's network device type")
|
||||||
baseCmd.PersistentFlags().StringVar(&SetNetOnBoot, "onboot", "", "Enable/disable device (yes/no)")
|
baseCmd.PersistentFlags().StringVar(&SetNetOnBoot, "onboot", "", "Enable/disable device (yes/no)")
|
||||||
|
baseCmd.PersistentFlags().StringVar(&SetNetDefault, "default", "", "Enable/disable device as default (yes/no)")
|
||||||
|
|
||||||
baseCmd.PersistentFlags().BoolVar(&SetNetDevDel, "netdel", false, "Delete the node's network device")
|
baseCmd.PersistentFlags().BoolVar(&SetNetDevDel, "netdel", false, "Delete the node's network device")
|
||||||
|
|
||||||
|
|||||||
@@ -87,7 +87,6 @@ func (config *nodeYaml) FindAllNodes() ([]NodeInfo, error) {
|
|||||||
n.NetDevs[devname] = &netdev
|
n.NetDevs[devname] = &netdev
|
||||||
}
|
}
|
||||||
|
|
||||||
n.NetDevs[devname].Name.Set(devname)
|
|
||||||
n.NetDevs[devname].Device.Set(netdev.Device)
|
n.NetDevs[devname].Device.Set(netdev.Device)
|
||||||
n.NetDevs[devname].Ipaddr.Set(netdev.Ipaddr)
|
n.NetDevs[devname].Ipaddr.Set(netdev.Ipaddr)
|
||||||
n.NetDevs[devname].Netmask.Set(netdev.Netmask)
|
n.NetDevs[devname].Netmask.Set(netdev.Netmask)
|
||||||
@@ -95,6 +94,7 @@ func (config *nodeYaml) FindAllNodes() ([]NodeInfo, error) {
|
|||||||
n.NetDevs[devname].Gateway.Set(netdev.Gateway)
|
n.NetDevs[devname].Gateway.Set(netdev.Gateway)
|
||||||
n.NetDevs[devname].Type.Set(netdev.Type)
|
n.NetDevs[devname].Type.Set(netdev.Type)
|
||||||
n.NetDevs[devname].OnBoot.SetB(netdev.OnBoot)
|
n.NetDevs[devname].OnBoot.SetB(netdev.OnBoot)
|
||||||
|
n.NetDevs[devname].Default.SetB(netdev.Default)
|
||||||
}
|
}
|
||||||
|
|
||||||
for keyname, key := range node.Keys {
|
for keyname, key := range node.Keys {
|
||||||
@@ -148,6 +148,7 @@ func (config *nodeYaml) FindAllNodes() ([]NodeInfo, error) {
|
|||||||
n.NetDevs[devname].Gateway.SetAlt(netdev.Gateway, p)
|
n.NetDevs[devname].Gateway.SetAlt(netdev.Gateway, p)
|
||||||
n.NetDevs[devname].Type.SetAlt(netdev.Type, p)
|
n.NetDevs[devname].Type.SetAlt(netdev.Type, p)
|
||||||
n.NetDevs[devname].OnBoot.SetAltB(netdev.OnBoot, p)
|
n.NetDevs[devname].OnBoot.SetAltB(netdev.OnBoot, p)
|
||||||
|
n.NetDevs[devname].Default.SetAltB(netdev.Default, p)
|
||||||
}
|
}
|
||||||
|
|
||||||
for keyname, key := range config.NodeProfiles[p].Keys {
|
for keyname, key := range config.NodeProfiles[p].Keys {
|
||||||
@@ -213,7 +214,6 @@ func (config *nodeYaml) FindAllProfiles() ([]NodeInfo, error) {
|
|||||||
|
|
||||||
wwlog.Printf(wwlog.DEBUG, "Updating profile netdev: %s\n", devname)
|
wwlog.Printf(wwlog.DEBUG, "Updating profile netdev: %s\n", devname)
|
||||||
|
|
||||||
p.NetDevs[devname].Name.Set(devname)
|
|
||||||
p.NetDevs[devname].Device.Set(netdev.Device)
|
p.NetDevs[devname].Device.Set(netdev.Device)
|
||||||
p.NetDevs[devname].Ipaddr.Set(netdev.Ipaddr)
|
p.NetDevs[devname].Ipaddr.Set(netdev.Ipaddr)
|
||||||
p.NetDevs[devname].Netmask.Set(netdev.Netmask)
|
p.NetDevs[devname].Netmask.Set(netdev.Netmask)
|
||||||
@@ -221,6 +221,7 @@ func (config *nodeYaml) FindAllProfiles() ([]NodeInfo, error) {
|
|||||||
p.NetDevs[devname].Gateway.Set(netdev.Gateway)
|
p.NetDevs[devname].Gateway.Set(netdev.Gateway)
|
||||||
p.NetDevs[devname].Type.Set(netdev.Type)
|
p.NetDevs[devname].Type.Set(netdev.Type)
|
||||||
p.NetDevs[devname].OnBoot.SetB(netdev.OnBoot)
|
p.NetDevs[devname].OnBoot.SetB(netdev.OnBoot)
|
||||||
|
p.NetDevs[devname].Default.SetB(netdev.Default)
|
||||||
}
|
}
|
||||||
|
|
||||||
for keyname, key := range profile.Keys {
|
for keyname, key := range profile.Keys {
|
||||||
|
|||||||
@@ -39,16 +39,16 @@ type NodeConf struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type NetDevs struct {
|
type NetDevs struct {
|
||||||
Name string
|
Type string
|
||||||
Type string `yaml:"type,omitempty"`
|
OnBoot bool
|
||||||
OnBoot bool `yaml:"onboot"`
|
Device string
|
||||||
Device string `yaml:"device"`
|
|
||||||
Hwaddr string
|
Hwaddr string
|
||||||
Ipaddr string
|
Ipaddr string
|
||||||
IpCIDR string
|
IpCIDR string `yaml:"ipcidr,omitempty"`
|
||||||
Prefix string
|
Prefix string `yaml:"prefix,omitempty"`
|
||||||
Netmask string
|
Netmask string
|
||||||
Gateway string `yaml:"gateway,omitempty"`
|
Gateway string `yaml:"gateway"`
|
||||||
|
Default bool
|
||||||
}
|
}
|
||||||
|
|
||||||
/******
|
/******
|
||||||
@@ -92,16 +92,16 @@ type NodeInfo struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type NetDevEntry struct {
|
type NetDevEntry struct {
|
||||||
Name Entry
|
Type Entry
|
||||||
Type Entry `yaml:"type,omitempty"`
|
OnBoot Entry
|
||||||
OnBoot Entry `yaml:"onboot"`
|
Device Entry
|
||||||
Device Entry `yaml:"device"`
|
|
||||||
Hwaddr Entry
|
Hwaddr Entry
|
||||||
Ipaddr Entry
|
Ipaddr Entry
|
||||||
IpCIDR Entry
|
IpCIDR Entry
|
||||||
Prefix Entry
|
Prefix Entry
|
||||||
Netmask Entry
|
Netmask Entry
|
||||||
Gateway Entry `yaml:"gateway,omitempty"`
|
Gateway Entry
|
||||||
|
Default Entry
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
|||||||
@@ -91,6 +91,7 @@ func (config *nodeYaml) NodeUpdate(node NodeInfo) error {
|
|||||||
config.Nodes[nodeID].NetDevs[devname].Gateway = netdev.Gateway.GetReal()
|
config.Nodes[nodeID].NetDevs[devname].Gateway = netdev.Gateway.GetReal()
|
||||||
config.Nodes[nodeID].NetDevs[devname].Type = netdev.Type.GetReal()
|
config.Nodes[nodeID].NetDevs[devname].Type = netdev.Type.GetReal()
|
||||||
config.Nodes[nodeID].NetDevs[devname].OnBoot = netdev.OnBoot.GetRealB()
|
config.Nodes[nodeID].NetDevs[devname].OnBoot = netdev.OnBoot.GetRealB()
|
||||||
|
config.Nodes[nodeID].NetDevs[devname].Default = netdev.Default.GetRealB()
|
||||||
}
|
}
|
||||||
|
|
||||||
for keyname, key := range node.Keys {
|
for keyname, key := range node.Keys {
|
||||||
@@ -177,6 +178,7 @@ func (config *nodeYaml) ProfileUpdate(profile NodeInfo) error {
|
|||||||
config.NodeProfiles[profileID].NetDevs[devname].Gateway = netdev.Gateway.GetReal()
|
config.NodeProfiles[profileID].NetDevs[devname].Gateway = netdev.Gateway.GetReal()
|
||||||
config.NodeProfiles[profileID].NetDevs[devname].Type = netdev.Type.GetReal()
|
config.NodeProfiles[profileID].NetDevs[devname].Type = netdev.Type.GetReal()
|
||||||
config.NodeProfiles[profileID].NetDevs[devname].OnBoot = netdev.OnBoot.GetRealB()
|
config.NodeProfiles[profileID].NetDevs[devname].OnBoot = netdev.OnBoot.GetRealB()
|
||||||
|
config.NodeProfiles[profileID].NetDevs[devname].Default = netdev.Default.GetRealB()
|
||||||
}
|
}
|
||||||
|
|
||||||
for keyname, key := range profile.Keys {
|
for keyname, key := range profile.Keys {
|
||||||
|
|||||||
@@ -187,7 +187,6 @@ func BuildOverlay(nodeInfo node.NodeInfo, overlayName string) error {
|
|||||||
for devname, netdev := range nodeInfo.NetDevs {
|
for devname, netdev := range nodeInfo.NetDevs {
|
||||||
var nd node.NetDevs
|
var nd node.NetDevs
|
||||||
tstruct.NetDevs[devname] = &nd
|
tstruct.NetDevs[devname] = &nd
|
||||||
tstruct.NetDevs[devname].Name = devname
|
|
||||||
tstruct.NetDevs[devname].Device = netdev.Device.Get()
|
tstruct.NetDevs[devname].Device = netdev.Device.Get()
|
||||||
tstruct.NetDevs[devname].Hwaddr = netdev.Hwaddr.Get()
|
tstruct.NetDevs[devname].Hwaddr = netdev.Hwaddr.Get()
|
||||||
tstruct.NetDevs[devname].Ipaddr = netdev.Ipaddr.Get()
|
tstruct.NetDevs[devname].Ipaddr = netdev.Ipaddr.Get()
|
||||||
|
|||||||
Reference in New Issue
Block a user