mirror of
https://github.com/mulgadc/spinifex.git
synced 2026-10-19 19:01:42 +00:00
5f8ee0b5a2
In the PXE path SPINIFEX_INSTALL_CALLBACK arrives on the iPXE kernel cmdline but was never threaded into the firstboot script, so firstboot never curled the controller's /done endpoint. The flag stayed on disk, the node re-entered the install loop on the next PXE boot. Fix: read SPINIFEX_INSTALL_CALLBACK from the live-environment env in toFirstbootConfig and embed a best-effort curl into the generated firstboot script, fired once after the success marker is written. Interactive and USB-stick installs are unaffected (env var absent -> callbackBlock is empty, no curl injected).
28 lines
719 B
Go
28 lines
719 B
Go
package install
|
|
|
|
import (
|
|
"os"
|
|
"testing"
|
|
)
|
|
|
|
func TestToFirstbootConfigIncludesInstallCallback(t *testing.T) {
|
|
const url = "http://192.168.1.12/boot/done?mac=aa:bb:cc:dd:ee:ff"
|
|
t.Setenv("SPINIFEX_INSTALL_CALLBACK", url)
|
|
|
|
cfg := &Config{Hostname: "node1", ClusterRole: "init"}
|
|
fb := cfg.toFirstbootConfig()
|
|
if fb.InstallCallback != url {
|
|
t.Errorf("InstallCallback = %q, want %q", fb.InstallCallback, url)
|
|
}
|
|
}
|
|
|
|
func TestToFirstbootConfigEmptyCallbackWhenEnvUnset(t *testing.T) {
|
|
os.Unsetenv("SPINIFEX_INSTALL_CALLBACK")
|
|
|
|
cfg := &Config{Hostname: "node1", ClusterRole: "init"}
|
|
fb := cfg.toFirstbootConfig()
|
|
if fb.InstallCallback != "" {
|
|
t.Errorf("InstallCallback = %q, want empty", fb.InstallCallback)
|
|
}
|
|
}
|