Misc whitespace handling fixes

Also fixes handling of mtu value in Debian networking.

Signed-off-by: Jonathon Anderson <janderson@ciq.com>
This commit is contained in:
Jonathon Anderson
2024-10-18 00:31:19 -04:00
parent d3cd31fdc0
commit 4b4234994c
6 changed files with 19 additions and 21 deletions

View File

@@ -112,7 +112,7 @@ nodes:
nodeprofiles: {}
nodes:
n01:
ipmi:
ipmi:
write: "true"
`}
run_test(t, test)
@@ -131,7 +131,7 @@ nodes:
nodeprofiles: {}
nodes:
n01:
ipmi:
ipmi:
write: "true"
`}
run_test(t, test)
@@ -146,7 +146,7 @@ func Test_Unset_Ipmi_Write(t *testing.T) {
nodeprofiles: {}
nodes:
n01:
ipmi:
ipmi:
write: "true"
`,
outDb: `WW_INTERNAL: 43
@@ -165,7 +165,7 @@ func Test_Unset_Ipmi_Write_False(t *testing.T) {
nodeprofiles: {}
nodes:
n01:
ipmi:
ipmi:
write: "false"
`,
outDb: `WW_INTERNAL: 43
@@ -183,7 +183,7 @@ func Test_Ipmi_Hidden_False(t *testing.T) {
inDB: `WW_INTERNAL: 43
nodeprofiles:
default:
ipmi:
ipmi:
write: "true"
nodes:
n01:

View File

@@ -57,7 +57,7 @@ iface wwnet0 inet static
address 192.168.3.21
netmask 255.255.255.0
gateway 192.168.3.1
mtu
mtu 1500
backupFile: true
writeFile: true
Filename: secondary
@@ -68,6 +68,6 @@ iface wwnet1 inet static
address 192.168.3.22
netmask 255.255.255.0
gateway 192.168.3.1
mtu
mtu 9000
up ifmetric wwnet1 30
`

View File

@@ -7,9 +7,11 @@ nodes:
ipaddr: 192.168.3.21
netmask: 255.255.255.0
gateway: 192.168.3.1
mtu: 1500
secondary:
device: wwnet1
hwaddr: 9a:77:29:73:14:f1
ipaddr: 192.168.3.22
netmask: 255.255.255.0
gateway: 192.168.3.1
mtu: 9000

View File

@@ -9,7 +9,7 @@ allow-hotplug {{$netdev.Device}}
iface {{$netdev.Device}} inet static
address {{$netdev.Ipaddr}}
netmask {{$netdev.Netmask}}
{{ if $netdev.Gateway }}gateway {{$netdev.Gateway}}{{end}}
mtu {{$netdev.MTU}}
{{ if $netdev.Gateway }}gateway {{$netdev.Gateway}}{{- end}}
{{ if $netdev.MTU }}mtu {{$netdev.MTU}}{{- end}}
up ifmetric {{$netdev.Device}} 30
{{- end}}

View File

@@ -268,9 +268,8 @@ dhcp-boot=tag:iPXE,"http://192.168.0.1:9873/ipxe/${mac:hexhyp}?assetkey=${asset}
dhcp-no-override
# define the the range
dhcp-range=192.168.0.100,192.168.0.199,255.255.255.0,6h
dhcp-host=e6:92:39:49:7b:03,set:warewulf,node1,192.168.3.21,infinite
dhcp-host=9a:77:29:73:14:f1,set:warewulf,node1,192.168.3.22,infinite
dhcp-host=e6:92:39:49:7b:03,set:warewulf,node1,192.168.3.21,infinite
dhcp-host=9a:77:29:73:14:f1,set:warewulf,node1,192.168.3.22,infinite
dhcp-host=e6:92:39:49:7b:04,set:warewulf,node2,192.168.3.23,infinite
`

View File

@@ -32,13 +32,10 @@ tftp-root={{ $.Tftp.TftpRoot }}
{{- end }}
# define the the range
dhcp-range={{$.Dhcp.RangeStart}},{{$.Dhcp.RangeEnd}},{{$.Netmask}},6h
{{/* Add all the known hosts */}}
{{- range $node := $.AllNodes}} {{/* for each node */}}
{{- range $devname, $netdev := $node.NetDevs}} {{/* for each network device on the node */}}
{{- if $netdev.Ipaddr}} {{/* if we have an ip address on this network device */}}
{{- if $netdev.Hwaddr }}
{{ range $node := $.AllNodes -}}
{{ range $devname, $netdev := $node.NetDevs -}}
{{ if and $netdev.Ipaddr $netdev.Hwaddr -}}
dhcp-host={{$netdev.Hwaddr}},set:warewulf,{{$node.Id}},{{$netdev.Ipaddr}},infinite
{{- end}}{{/* end if Hwaddr */}}
{{- end}}{{/* end if ip */}}
{{- end}}{{/* end for each network device */}}
{{- end}}{{/* end for each node */}}
{{- end }}
{{ end -}}
{{ end -}}