Move tstruct.Overlay from wwctl to overlay.InitStruct
Signed-off-by: Jonathon Anderson <janderson@ciq.com>
This commit is contained in:
committed by
Christian Goll
parent
c03dc9436b
commit
0b00233ab7
@@ -57,12 +57,11 @@ func CobraRunE(cmd *cobra.Command, args []string) error {
|
|||||||
nodeConf = node.NewNode(hostName)
|
nodeConf = node.NewNode(hostName)
|
||||||
nodeConf.ClusterName = hostName
|
nodeConf.ClusterName = hostName
|
||||||
}
|
}
|
||||||
tstruct, err := overlay.InitStruct(nodeConf)
|
tstruct, err := overlay.InitStruct(overlayName, nodeConf)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
tstruct.BuildSource = overlayFile
|
tstruct.BuildSource = overlayFile
|
||||||
tstruct.Overlay = overlayName
|
|
||||||
buffer, backupFile, writeFile, err := overlay.RenderTemplateFile(overlayFile, tstruct)
|
buffer, backupFile, writeFile, err := overlay.RenderTemplateFile(overlayFile, tstruct)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ func Hostfile() (err error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
hostname, _ := os.Hostname()
|
hostname, _ := os.Hostname()
|
||||||
tstruct, err := overlay.InitStruct(node.NewNode(hostname))
|
tstruct, err := overlay.InitStruct(overlay_.Name(), node.NewNode(hostname))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,8 +46,9 @@ type TemplateStruct struct {
|
|||||||
/*
|
/*
|
||||||
Initialize an TemplateStruct with the given node.NodeInfo
|
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
|
var tstruct TemplateStruct
|
||||||
|
tstruct.Overlay = overlayName
|
||||||
hostname, _ := os.Hostname()
|
hostname, _ := os.Hostname()
|
||||||
tstruct.BuildHost = hostname
|
tstruct.BuildHost = hostname
|
||||||
controller := warewulfconf.Get()
|
controller := warewulfconf.Get()
|
||||||
|
|||||||
@@ -283,7 +283,7 @@ func BuildOverlayIndir(nodeData node.Node, overlayNames []string, outputDir stri
|
|||||||
wwlog.Debug("Created directory in overlay: %s", location)
|
wwlog.Debug("Created directory in overlay: %s", location)
|
||||||
|
|
||||||
} else if filepath.Ext(location) == ".ww" {
|
} else if filepath.Ext(location) == ".ww" {
|
||||||
tstruct, err := InitStruct(nodeData)
|
tstruct, err := InitStruct(overlayName, nodeData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to initial data for %s: %w", nodeData.Id(), err)
|
return fmt.Errorf("failed to initial data for %s: %w", nodeData.Id(), err)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user