diff --git a/internal/pkg/node/datastructure.go b/internal/pkg/node/datastructure.go index b1d0ff67..1d78cca3 100644 --- a/internal/pkg/node/datastructure.go +++ b/internal/pkg/node/datastructure.go @@ -79,7 +79,7 @@ type KernelConf struct { type NetDevs struct { Type string `yaml:"type,omitempty" lopt:"type" sopt:"T" comment:"Set device type of given network"` - Manual bool `yaml:"manual,omitempty" lopt:"manual" comment:"Enable/disable network device (true/false)"` + OnBoot *bool `yaml:"onboot,omitempty" lopt:"onboot" comment:"Enable/disable network device (true/false)"` Device string `yaml:"device,omitempty" lopt:"netdev" sopt:"N" comment:"Set the device for given network"` Hwaddr string `yaml:"hwaddr,omitempty" lopt:"hwaddr" sopt:"H" comment:"Set the device's HW address for given network" type:"MAC"` Ipaddr net.IP `yaml:"ipaddr,omitempty" comment:"IPv4 address in given network" sopt:"I" lopt:"ipaddr" type:"IP"` diff --git a/overlays/NetworkManager/internal/nodes.conf b/overlays/NetworkManager/internal/nodes.conf index 5039a62b..fefbdbc8 100644 --- a/overlays/NetworkManager/internal/nodes.conf +++ b/overlays/NetworkManager/internal/nodes.conf @@ -4,12 +4,14 @@ nodes: network devices: default: device: wwnet0 + onboot: true hwaddr: e6:92:39:49:7b:03 ipaddr: 192.168.3.21 netmask: 255.255.255.0 gateway: 192.168.3.1 secondary: device: wwnet1 + onboot: true hwaddr: 9a:77:29:73:14:f1 ipaddr: 192.168.3.22 netmask: 255.255.255.0 diff --git a/overlays/NetworkManager/rootfs/etc/NetworkManager/system-connections/ww4-managed.ww b/overlays/NetworkManager/rootfs/etc/NetworkManager/system-connections/ww4-managed.ww index e8d1db84..c4adc114 100644 --- a/overlays/NetworkManager/rootfs/etc/NetworkManager/system-connections/ww4-managed.ww +++ b/overlays/NetworkManager/rootfs/etc/NetworkManager/system-connections/ww4-managed.ww @@ -13,7 +13,9 @@ master={{ $master }} type=ethernet {{ else -}} type={{if $netdev.Type}}{{ $netdev.Type }}{{ else }}ethernet{{end}} -autoconnect={{ if $netdev.Manual }}false{{else}}true{{end}} +{{ if or $netdev.OnBoot (eq $netdev.OnBoot nil) -}} +autoconnect=true +{{ end -}} {{ end -}} {{ if $netdev.Hwaddr -}} {{ if or (eq $netdev.Type "ethernet") (not $netdev.Type ) -}} diff --git a/overlays/debian.interfaces/rootfs/etc/network/interfaces.d/default.ww b/overlays/debian.interfaces/rootfs/etc/network/interfaces.d/default.ww index f0559472..a968c1f1 100644 --- a/overlays/debian.interfaces/rootfs/etc/network/interfaces.d/default.ww +++ b/overlays/debian.interfaces/rootfs/etc/network/interfaces.d/default.ww @@ -2,7 +2,7 @@ {{- $filename := print $devname }} {{- file $filename }} # This file is autogenerated by warewulf -{{ if not $netdev.Manual -}} +{{ if or $netdev.OnBoot (eq $netdev.OnBoot nil) -}} auto {{$netdev.Device}} {{ end -}} allow-hotplug {{$netdev.Device}} diff --git a/overlays/debug/internal/debug_test.go b/overlays/debug/internal/debug_test.go index fb265b12..eb396122 100644 --- a/overlays/debug/internal/debug_test.go +++ b/overlays/debug/internal/debug_test.go @@ -101,7 +101,7 @@ data from other structures. - Tags: - NetDevs[default]: - Type: - - Manual: false + - OnBoot: true - Device: wwnet0 - Hwaddr: e6:92:39:49:7b:03 - Ipaddr: 192.168.3.21 @@ -114,7 +114,7 @@ data from other structures. - Tags: - NetDevs[secondary]: - Type: - - Manual: false + - OnBoot: true - Device: wwnet1 - Hwaddr: 9a:77:29:73:14:f1 - Ipaddr: 192.168.3.22 @@ -212,7 +212,7 @@ data from other structures. - Tags: - NetDevs[default]: - Type: - - Manual: false + - OnBoot: true - Device: wwnet0 - Hwaddr: e6:92:39:49:7b:03 - Ipaddr: 192.168.3.21 @@ -226,7 +226,7 @@ data from other structures. - Tags: - NetDevs[secondary]: - Type: - - Manual: false + - OnBoot: true - Device: wwnet1 - Hwaddr: 9a:77:29:73:14:f1 - Ipaddr: 192.168.3.22 @@ -267,7 +267,7 @@ data from other structures. - Tags: - NetDevs[default]: - Type: - - Manual: false + - OnBoot: true - Device: wwnet0 - Hwaddr: e6:92:39:49:7b:04 - Ipaddr: 192.168.3.23 diff --git a/overlays/debug/internal/nodes.conf b/overlays/debug/internal/nodes.conf index 34a7646a..0aeadbcf 100644 --- a/overlays/debug/internal/nodes.conf +++ b/overlays/debug/internal/nodes.conf @@ -32,12 +32,14 @@ nodes: network devices: default: device: wwnet0 + onboot: true hwaddr: e6:92:39:49:7b:03 ipaddr: 192.168.3.21 netmask: 255.255.255.0 gateway: 192.168.3.1 secondary: device: wwnet1 + onboot: true hwaddr: 9a:77:29:73:14:f1 ipaddr: 192.168.3.22 netmask: 255.255.255.0 @@ -75,6 +77,7 @@ nodes: network devices: default: device: wwnet0 + onboot: true hwaddr: e6:92:39:49:7b:04 ipaddr: 192.168.3.23 netmask: 255.255.255.0 diff --git a/overlays/debug/rootfs/warewulf/template-variables.md.ww b/overlays/debug/rootfs/warewulf/template-variables.md.ww index fa051f36..92fb14d6 100644 --- a/overlays/debug/rootfs/warewulf/template-variables.md.ww +++ b/overlays/debug/rootfs/warewulf/template-variables.md.ww @@ -44,7 +44,7 @@ data from other structures. {{- range $index, $netdev := .NetDevs }} - NetDevs[{{ $index }}]: - Type: {{ $netdev.Type }} - - Manual: {{ $netdev.Manual }} + - OnBoot: {{ $netdev.OnBoot }} - Device: {{ $netdev.Device }} - Hwaddr: {{ $netdev.Hwaddr }} - Ipaddr: {{ $netdev.Ipaddr }} @@ -154,7 +154,7 @@ data from other structures. {{- range $index, $netdev := $node.NetDevs }} - NetDevs[{{ $index }}]: - Type: {{ $netdev.Type }} - - Manual: {{ $netdev.Manual }} + - OnBoot: {{ $netdev.OnBoot }} - Device: {{ $netdev.Device }} - Hwaddr: {{ $netdev.Hwaddr }} - Ipaddr: {{ $netdev.Ipaddr }} diff --git a/overlays/ifcfg/rootfs/etc/sysconfig/network-scripts/ifcfg.ww b/overlays/ifcfg/rootfs/etc/sysconfig/network-scripts/ifcfg.ww index 997c84a3..d3ac924c 100644 --- a/overlays/ifcfg/rootfs/etc/sysconfig/network-scripts/ifcfg.ww +++ b/overlays/ifcfg/rootfs/etc/sysconfig/network-scripts/ifcfg.ww @@ -22,9 +22,7 @@ GATEWAY={{ $netdev.Gateway }} {{ if $netdev.Hwaddr -}} HWADDR={{ $netdev.Hwaddr }} {{ end -}} -{{ if $netdev.Manual -}} -ONBOOT=false -{{ else -}} +{{ if or $netdev.OnBoot (eq $netdev.OnBoot nil) -}} ONBOOT=true {{ end -}} IPV6INIT=yes diff --git a/overlays/wicked/rootfs/etc/wicked/ifconfig/ifcfg.xml.ww b/overlays/wicked/rootfs/etc/wicked/ifconfig/ifcfg.xml.ww index 54107a56..6b681a45 100644 --- a/overlays/wicked/rootfs/etc/wicked/ifconfig/ifcfg.xml.ww +++ b/overlays/wicked/rootfs/etc/wicked/ifconfig/ifcfg.xml.ww @@ -16,7 +16,7 @@ This file is autogenerated by warewulf {{ $netdev.MTU }} {{ end -}} - {{ if $netdev.Manual -}}manual{{ else }}boot{{end}} + {{ if or $netdev.OnBoot (eq $netdev.OnBoot nil) }}boot{{ else }}manual{{end}}