Revert NetDevs.Manual back to NetDevs.OnBoot

Signed-off-by: Jonathon Anderson <janderson@ciq.com>
This commit is contained in:
Jonathon Anderson
2024-10-17 22:55:31 -04:00
parent adb54a870d
commit bb5d1d17ed
9 changed files with 19 additions and 14 deletions

View File

@@ -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"`

View File

@@ -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

View File

@@ -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 ) -}}

View File

@@ -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}}

View File

@@ -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

View File

@@ -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

View File

@@ -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 }}

View File

@@ -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

View File

@@ -16,7 +16,7 @@ This file is autogenerated by warewulf
<mtu>{{ $netdev.MTU }}</mtu>
{{ end -}}
<control>
<mode>{{ if $netdev.Manual -}}manual{{ else }}boot{{end}}</mode>
<mode>{{ if or $netdev.OnBoot (eq $netdev.OnBoot nil) }}boot{{ else }}manual{{end}}</mode>
</control>
<firewall/>
<link/>