diff --git a/CHANGELOG.md b/CHANGELOG.md index 65b62921..7a3b8d63 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -38,6 +38,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Replace slice in templates with sprig substr. #1093 - Fix an invalid format issue for the GitHub nightly build action. #1258 - Fix broken `/etc/warewulf/excludes` handling #1266 +- Fix wwclient not reading asset-tag. #1110 +- Fix iPXE script not including asset-tag #1110 ## v4.5.4, 2024-06-12 diff --git a/internal/app/wwclient/root.go b/internal/app/wwclient/root.go index 7cd728bc..3f9c08b3 100644 --- a/internal/app/wwclient/root.go +++ b/internal/app/wwclient/root.go @@ -126,6 +126,15 @@ func CobraRunE(cmd *cobra.Command, args []string) (err error) { localUUID, _ = sysinfoDump.UUID() x := smbiosDump.SystemEnclosure() tag = strings.ReplaceAll(x.AssetTagNumber(), " ", "_") + if tag == "Unknown" { + dmiOut, err := exec.Command("dmidecode", "-s", "chassis-asset-tag").Output() + if err == nil { + chassisAssetTag := strings.TrimSpace(string(dmiOut)) + if chassisAssetTag != "" { + tag = chassisAssetTag + } + } + } } else { // Raspberry Pi serial and DUID locations // /sys/firmware/devicetree/base/serial-number diff --git a/overlays/host/rootfs/etc/dhcp/dhcpd.conf.ww b/overlays/host/rootfs/etc/dhcp/dhcpd.conf.ww index b95d8200..78f715dd 100644 --- a/overlays/host/rootfs/etc/dhcp/dhcpd.conf.ww +++ b/overlays/host/rootfs/etc/dhcp/dhcpd.conf.ww @@ -39,7 +39,7 @@ if substring (option vendor-class-identifier, 0, 9) = "PXEClient" { } {{- else }} if exists user-class and option user-class = "iPXE" { - filename "http://{{$.Ipaddr}}:{{$.Warewulf.Port}}/ipxe/${mac:hexhyp}"; + filename "http://{{$.Ipaddr}}:{{$.Warewulf.Port}}/ipxe/${mac:hexhyp}?assetkey=${asset}&uuid=${uuid}"; } else { {{range $type,$name := $.Tftp.IpxeBinaries }} if option architecture-type = {{ $type }} { diff --git a/overlays/host/rootfs/etc/dnsmasq.d/ww4-hosts.conf.ww b/overlays/host/rootfs/etc/dnsmasq.d/ww4-hosts.conf.ww index ce7ae6e3..d942faf3 100644 --- a/overlays/host/rootfs/etc/dnsmasq.d/ww4-hosts.conf.ww +++ b/overlays/host/rootfs/etc/dnsmasq.d/ww4-hosts.conf.ww @@ -26,7 +26,7 @@ dhcp-boot=tag:aarch64,"/warewulf/{{ index $.Tftp.IpxeBinaries "00:0B" }}" {{- end }} {{- end }} # iPXE binary will get the following configuration file -dhcp-boot=tag:iPXE,"http://{{$.Ipaddr}}:{{$.Warewulf.Port}}/ipxe/${mac:hexhyp}" +dhcp-boot=tag:iPXE,"http://{{$.Ipaddr}}:{{$.Warewulf.Port}}/ipxe/${mac:hexhyp}?assetkey=${asset}&uuid=${uuid}" dhcp-no-override {{- if $.Tftp.Enabled }} # also act as tftp server