diff --git a/internal/app/wwctl/overlay/show/main.go b/internal/app/wwctl/overlay/show/main.go index 01fdba77..97f7a3e4 100644 --- a/internal/app/wwctl/overlay/show/main.go +++ b/internal/app/wwctl/overlay/show/main.go @@ -57,12 +57,11 @@ func CobraRunE(cmd *cobra.Command, args []string) error { nodeConf = node.NewNode(hostName) nodeConf.ClusterName = hostName } - tstruct, err := overlay.InitStruct(nodeConf) + tstruct, err := overlay.InitStruct(overlayName, nodeConf) if err != nil { return err } tstruct.BuildSource = overlayFile - tstruct.Overlay = overlayName buffer, backupFile, writeFile, err := overlay.RenderTemplateFile(overlayFile, tstruct) if err != nil { return err diff --git a/internal/pkg/configure/hostfile.go b/internal/pkg/configure/hostfile.go index 1faafabe..3046eb41 100644 --- a/internal/pkg/configure/hostfile.go +++ b/internal/pkg/configure/hostfile.go @@ -21,7 +21,7 @@ func Hostfile() (err error) { } hostname, _ := os.Hostname() - tstruct, err := overlay.InitStruct(node.NewNode(hostname)) + tstruct, err := overlay.InitStruct(overlay_.Name(), node.NewNode(hostname)) if err != nil { return err } diff --git a/internal/pkg/overlay/datastructure.go b/internal/pkg/overlay/datastructure.go index d2c71d5b..67c61d5f 100644 --- a/internal/pkg/overlay/datastructure.go +++ b/internal/pkg/overlay/datastructure.go @@ -46,8 +46,9 @@ type TemplateStruct struct { /* Initialize an TemplateStruct with the given node.NodeInfo */ -func InitStruct(nodeData node.Node) (TemplateStruct, error) { +func InitStruct(overlayName string, nodeData node.Node) (TemplateStruct, error) { var tstruct TemplateStruct + tstruct.Overlay = overlayName hostname, _ := os.Hostname() tstruct.BuildHost = hostname controller := warewulfconf.Get() diff --git a/internal/pkg/overlay/overlay.go b/internal/pkg/overlay/overlay.go index 133633b9..5628d004 100644 --- a/internal/pkg/overlay/overlay.go +++ b/internal/pkg/overlay/overlay.go @@ -283,7 +283,7 @@ func BuildOverlayIndir(nodeData node.Node, overlayNames []string, outputDir stri wwlog.Debug("Created directory in overlay: %s", location) } else if filepath.Ext(location) == ".ww" { - tstruct, err := InitStruct(nodeData) + tstruct, err := InitStruct(overlayName, nodeData) if err != nil { return fmt.Errorf("failed to initial data for %s: %w", nodeData.Id(), err) }