use list of resources in profiles/nodes

access the resource not at node or profile level but
in the templates as global variable

Signed-off-by: Christian Goll <cgoll@suse.com>
This commit is contained in:
Christian Goll
2024-11-26 10:58:23 +01:00
committed by Jonathon Anderson
parent 5ff27061a3
commit 07c77a63d5
9 changed files with 34 additions and 17 deletions

View File

@@ -37,6 +37,7 @@ type TemplateStruct struct {
Tftp warewulfconf.TFTPConf
Paths warewulfconf.BuildConfig
AllNodes []node.Node
Resource map[string]node.RemoteRes
node.Node
// backward compatiblity
Container string
@@ -80,7 +81,8 @@ func InitStruct(overlayName string, nodeData node.Node, allNodes []node.Node) (T
dt := time.Now()
tstruct.BuildTime = dt.Format("01-02-2006 15:04:05 MST")
tstruct.BuildTimeUnix = strconv.FormatInt(dt.Unix(), 10)
tstruct.Node.Tags = map[string]string{}
// tstruct.Node.Tags = map[string]string{}
tstruct.Resource = nodeDB.Resource
var buf bytes.Buffer
enc := gob.NewEncoder(&buf)
dec := gob.NewDecoder(&buf)