From 4ee6c1f4cdb3c8c9cf30864e8e3d9e8ed636e933 Mon Sep 17 00:00:00 2001 From: Ben Vincent Date: Thu, 6 Aug 2026 22:19:04 +1000 Subject: [PATCH] Add inst.ks.sendmac to the iPXE boot script Cobbler's per-MAC gPXE script passed inst.ks.sendmac, making anaconda send its interface MACs as X-RHN-Provisioning-MAC-N headers when fetching the kickstart. bootapi's iPXE script omitted it, so the boot script was not a full drop-in for Cobbler's gpxe output. - Emit inst.ks.sendmac immediately before inst.ks= in the boot iPXE template, matching Cobbler ordering. - Assert the arg is present in the rendered catalog iPXE test. Claude-Session: https://claude.ai/code/session_01JUoARVdmhxKQHyyyp1pxeT --- internal/render/render_test.go | 2 +- templates/ipxe/boot.ipxe.tmpl | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/internal/render/render_test.go b/internal/render/render_test.go index f19ce93..a2e4ca0 100644 --- a/internal/render/render_test.go +++ b/internal/render/render_test.go @@ -136,7 +136,7 @@ func TestRenderIPXECatalog(t *testing.T) { mustContain(t, s, "kernel "+artifactBase+"/almalinux/9/BaseOS/x86_64/os/images/pxeboot/vmlinuz") mustContain(t, s, "initrd "+artifactBase+"/almalinux/9/BaseOS/x86_64/os/images/pxeboot/initrd.img") mustContain(t, s, "inst.repo="+artifactBase+"/almalinux/9/BaseOS/x86_64/os") - mustContain(t, s, "inst.ks=http://bootapi.example.net/ks/web01") + mustContain(t, s, "inst.ks.sendmac inst.ks=http://bootapi.example.net/ks/web01") mustContain(t, s, "inst.text") // catalog kernel arg mustContain(t, s, "net.ifnames=0") } diff --git a/templates/ipxe/boot.ipxe.tmpl b/templates/ipxe/boot.ipxe.tmpl index bf94c18..96fe21b 100644 --- a/templates/ipxe/boot.ipxe.tmpl +++ b/templates/ipxe/boot.ipxe.tmpl @@ -6,12 +6,14 @@ it. Mirrors how Cobbler generated a per-MAC gPXE script carrying inst.ks=. KernelURL/InitrdURL/RepoURL come from the selected catalog entry (artifactapi remote); KernelArgs are the catalog's extra args. KickstartURL uses -BOOTAPI_BASE_URL (http://). +BOOTAPI_BASE_URL (http://). inst.ks.sendmac makes anaconda send its interface +MACs as X-RHN-Provisioning-MAC-N headers when fetching the kickstart (Cobbler +parity; lets /ks resolve a host by MAC as well as by name). */ -}} #!ipxe echo bootapi: provisioning {{ .FQDN }} ({{ .Platform }}) {{ if and .KernelURL .InitrdURL -}} -kernel {{ .KernelURL }} initrd=initrd.img{{ if .RepoURL }} inst.repo={{ .RepoURL }}{{ end }} inst.ks={{ .KickstartURL }} ip=dhcp{{ range .KernelArgs }} {{ . }}{{ end }} +kernel {{ .KernelURL }} initrd=initrd.img{{ if .RepoURL }} inst.repo={{ .RepoURL }}{{ end }} inst.ks.sendmac inst.ks={{ .KickstartURL }} ip=dhcp{{ range .KernelArgs }} {{ . }}{{ end }} initrd {{ .InitrdURL }} boot {{- else -}} -- 2.47.3