Merge pull request #1263 from anderbubble/restore-dhcp-static

Restore previous behavior of static dhcp
This commit is contained in:
Christian Goll
2024-07-02 09:20:04 +02:00
committed by GitHub
2 changed files with 4 additions and 2 deletions

View File

@@ -46,6 +46,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Fix a regression in overlay autobuild. #1216
- Fix wwclient not reading asset-tag. #1110
- Fix dhcp not passing asset tag or uuid to iPXE. #1110
- Restored previous static dhcp behavior. #1263
## v4.5.6, unreleased

View File

@@ -51,8 +51,10 @@ if exists user-class and option user-class = "iPXE" {
subnet {{$.Network}} netmask {{$.Netmask}} {
max-lease-time 120;
{{- if ne .Dhcp.Template "static" }}
range {{$.Dhcp.RangeStart}} {{$.Dhcp.RangeEnd}};
next-server {{.Ipaddr}};
{{- end }}
}
{{- if eq .Dhcp.Template "static" }}
@@ -60,20 +62,19 @@ subnet {{$.Network}} netmask {{$.Netmask}} {
{{- range $netname, $netdevs := $nodes.NetDevs}}
host {{$nodes.Id.Get}}-{{$netname}}
{
{{- if $netdevs.Primary.GetB}}
{{- if $netdevs.Hwaddr.Defined}}
hardware ethernet {{$netdevs.Hwaddr.Get}};
{{- end }}
{{- if $netdevs.Ipaddr.Defined}}
fixed-address {{$netdevs.Ipaddr.Get}};
{{- end }}
{{- if $netdevs.Primary.GetB}}
option host-name "{{$nodes.Id.Get}}";
{{- end }}
}
{{end -}}{{/* range NetDevs */}}
{{end -}}{{/* range AllNodes */}}
{{end -}}{{/* if static */}}
{{- else}}
{{abort}}
{{- end}}{{/* dhcp enabled */}}