Merge pull request #961 from mslacken/FixInitOverridesConf

moved initialization of ConfigFile to New()
This commit is contained in:
Jonathon Anderson
2023-12-09 01:51:28 -07:00
committed by GitHub

View File

@@ -40,7 +40,10 @@ defaultnode:
netmask: 255.255.255.0
onboot: true`
func init() {
/*
Creates a new nodeDb object from the on-disk configuration
*/
func New() (NodeYaml, error) {
conf := warewulfconf.Get()
if ConfigFile == "" {
ConfigFile = path.Join(conf.Paths.Sysconfdir, "warewulf/nodes.conf")
@@ -48,12 +51,6 @@ func init() {
if DefaultConfig == "" {
DefaultConfig = path.Join(conf.Paths.Datadir, "warewulf/defaults.conf")
}
}
/*
Creates a new nodeDb object from the on-disk configuration
*/
func New() (NodeYaml, error) {
wwlog.Verbose("Opening node configuration file: %s", ConfigFile)
data, err := os.ReadFile(ConfigFile)
if err != nil {