From 037c456bc4d0c72b69862aa059367d521d241227 Mon Sep 17 00:00:00 2001 From: Jonathon Anderson Date: Fri, 11 Nov 2022 10:24:15 -0600 Subject: [PATCH] Correct host overlay processing during configure wwctl configure hostfile was using the /host/ path twice, causing it to look in the wrong place for /etc/hosts.ww Signed-off-by: Jonathon Anderson --- internal/pkg/configure/hostfile.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/internal/pkg/configure/hostfile.go b/internal/pkg/configure/hostfile.go index 15e0b7a8..5632ae9e 100644 --- a/internal/pkg/configure/hostfile.go +++ b/internal/pkg/configure/hostfile.go @@ -15,7 +15,8 @@ import ( Creates '/etc/hosts' from the host template. */ func Hostfile() error { - if !(util.IsFile(path.Join(overlay.OverlaySourceDir("host"), "/host/etc/hosts.ww"))) { + hostTemplate := path.Join(overlay.OverlaySourceDir("host"), "/etc/hosts.ww") + if !(util.IsFile(hostTemplate)) { wwlog.Error("'the overlay template '/etc/hosts.ww' does not exists in 'host' overlay") os.Exit(1) } @@ -24,13 +25,13 @@ func Hostfile() error { hostname, _ := os.Hostname() nodeInfo.Id.Set(hostname) buffer, backupFile, writeFile, err := overlay.RenderTemplateFile( - path.Join(overlay.OverlaySourceDir("host"), "/host/etc/hosts.ww"), + hostTemplate, tstruct) if err != nil { wwlog.Error("%s", err) os.Exit(1) } - info, err := os.Stat(path.Join(overlay.OverlaySourceDir("host"), "/host/etc/hosts.ww")) + info, err := os.Stat(hostTemplate) if err != nil { wwlog.Error("%s", err) os.Exit(1)