From 9ddb491ba39c0e125011336b32418afc9c96f190 Mon Sep 17 00:00:00 2001 From: Jonathon Anderson Date: Thu, 7 Nov 2024 21:50:08 -0700 Subject: [PATCH] Rename BmcTemplate to Template Signed-off-by: Jonathon Anderson --- internal/pkg/node/datastructure.go | 22 +++++++++++----------- internal/pkg/power/ipmitool.go | 10 +++++----- userdocs/contents/ipmi.rst | 4 ++-- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/internal/pkg/node/datastructure.go b/internal/pkg/node/datastructure.go index de593f95..bf44236b 100644 --- a/internal/pkg/node/datastructure.go +++ b/internal/pkg/node/datastructure.go @@ -59,17 +59,17 @@ type ProfileConf struct { } type IpmiConf struct { - UserName string `yaml:"username,omitempty" lopt:"ipmiuser" comment:"Set the IPMI username"` - Password string `yaml:"password,omitempty" lopt:"ipmipass" comment:"Set the IPMI password"` - Ipaddr net.IP `yaml:"ipaddr,omitempty" lopt:"ipmiaddr" comment:"Set the IPMI IP address" type:"IP"` - Gateway net.IP `yaml:"gateway,omitempty" lopt:"ipmigateway" comment:"Set the IPMI gateway" type:"IP"` - Netmask net.IP `yaml:"netmask,omitempty" lopt:"ipminetmask" comment:"Set the IPMI netmask" type:"IP"` - Port string `yaml:"port,omitempty" lopt:"ipmiport" comment:"Set the IPMI port"` - Interface string `yaml:"interface,omitempty" lopt:"ipmiinterface" comment:"Set the node's IPMI interface (defaults: 'lan')"` - EscapeChar string `yaml:"escapechar,omitempty" lopt:"ipmiescapechar" comment:"Set the IPMI escape character (defaults: '~')"` - Write wwtype.WWbool `yaml:"write,omitempty" lopt:"ipmiwrite" comment:"Enable the write of impi configuration (true/false)"` - BmcTemplate string `yaml:"template,omitempty" lopt:"ipmitemplate" comment:"template used for ipmi command"` - Tags map[string]string `yaml:"tags,omitempty"` + UserName string `yaml:"username,omitempty" lopt:"ipmiuser" comment:"Set the IPMI username"` + Password string `yaml:"password,omitempty" lopt:"ipmipass" comment:"Set the IPMI password"` + Ipaddr net.IP `yaml:"ipaddr,omitempty" lopt:"ipmiaddr" comment:"Set the IPMI IP address" type:"IP"` + Gateway net.IP `yaml:"gateway,omitempty" lopt:"ipmigateway" comment:"Set the IPMI gateway" type:"IP"` + Netmask net.IP `yaml:"netmask,omitempty" lopt:"ipminetmask" comment:"Set the IPMI netmask" type:"IP"` + Port string `yaml:"port,omitempty" lopt:"ipmiport" comment:"Set the IPMI port"` + Interface string `yaml:"interface,omitempty" lopt:"ipmiinterface" comment:"Set the node's IPMI interface (defaults: 'lan')"` + EscapeChar string `yaml:"escapechar,omitempty" lopt:"ipmiescapechar" comment:"Set the IPMI escape character (defaults: '~')"` + Write wwtype.WWbool `yaml:"write,omitempty" lopt:"ipmiwrite" comment:"Enable the write of impi configuration (true/false)"` + Template string `yaml:"template,omitempty" lopt:"ipmitemplate" comment:"template used for ipmi command"` + Tags map[string]string `yaml:"tags,omitempty"` } type KernelConf struct { diff --git a/internal/pkg/power/ipmitool.go b/internal/pkg/power/ipmitool.go index ace25d0c..fd6efe73 100644 --- a/internal/pkg/power/ipmitool.go +++ b/internal/pkg/power/ipmitool.go @@ -33,12 +33,12 @@ func (ipmi *IPMI) Result() (string, error) { func (ipmi *IPMI) getStr() (cmdStr string, err error) { conf := warewulfconf.Get() - if ipmi.BmcTemplate == "" { - ipmi.BmcTemplate = path.Join(conf.Warewulf.DataStore, "warewulf/bmc/ipmitool.tmpl") - } else if !strings.HasPrefix(ipmi.BmcTemplate, "/") { - ipmi.BmcTemplate = path.Join(conf.Warewulf.DataStore, "warewulf/bmc", ipmi.BmcTemplate) + if ipmi.Template == "" { + ipmi.Template = path.Join(conf.Warewulf.DataStore, "warewulf/bmc/ipmitool.tmpl") + } else if !strings.HasPrefix(ipmi.Template, "/") { + ipmi.Template = path.Join(conf.Warewulf.DataStore, "warewulf/bmc", ipmi.Template) } - fbuf, err := os.ReadFile(ipmi.BmcTemplate) + 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) } diff --git a/userdocs/contents/ipmi.rst b/userdocs/contents/ipmi.rst index c7cdc9a9..6a4036cd 100644 --- a/userdocs/contents/ipmi.rst +++ b/userdocs/contents/ipmi.rst @@ -240,7 +240,7 @@ All IPMI specific variables are accessible in the template which are the followi +---------------------+--------------------+ | ``--ipmiescapechar``| ``.EscapeChar`` | +---------------------+--------------------+ -| ``--ipmitemplate`` | ``.BmcTemplate`` | +| ``--ipmitemplate`` | ``.Template`` | +---------------------+--------------------+ Additional the ``.Args`` variable is accessible which can have following @@ -257,4 +257,4 @@ values: which are the calls done by `wwctl power` commands. Also the script ``/warewulf/init.d/50-ipmi`` in the **system** -overlay may need an update. There the variables must have the prefix ``.Ipmi`` \ No newline at end of file +overlay may need an update. There the variables must have the prefix ``.Ipmi``