Move default ipmi template to default profile

Signed-off-by: Jonathon Anderson <janderson@ciq.com>
This commit is contained in:
Jonathon Anderson
2024-11-07 21:59:13 -07:00
parent 9ddb491ba3
commit c25eaa8855
9 changed files with 14 additions and 4 deletions

View File

@@ -32,15 +32,16 @@ func (ipmi *IPMI) Result() (string, error) {
}
func (ipmi *IPMI) getStr() (cmdStr string, err error) {
conf := warewulfconf.Get()
if ipmi.Template == "" {
ipmi.Template = path.Join(conf.Warewulf.DataStore, "warewulf/bmc/ipmitool.tmpl")
} else if !strings.HasPrefix(ipmi.Template, "/") {
return "", fmt.Errorf("no ipmi/bmc template specified")
}
if !strings.HasPrefix(ipmi.Template, "/") {
conf := warewulfconf.Get()
ipmi.Template = path.Join(conf.Warewulf.DataStore, "warewulf/bmc", ipmi.Template)
}
fbuf, err := os.ReadFile(ipmi.Template)
if err != nil {
return "", fmt.Errorf("couldn't find the template which defines the ipmi/redfish command: %s", err)
return "", fmt.Errorf("couldn't find the template which defines the ipmi/bmc command: %s", err)
}
cmdTmpl, err := template.New("bmc command").Parse(string(fbuf))
if err != nil {