Refactor BaseConf Read and Parse

Also refactor New and Get to return pointers to match BaseConf methods.
This makes calling the methods immediately on the return values of the
constructors easier.

Also move config.ConfigFile to buildconfig.go.in. ConfigFile is still
used by wwctl as a default config file to reference; but it is removed
from other locations now.

Removed Persist, as nothing called it.

Signed-off-by: Jonathon Anderson <janderson@ciq.co>
This commit is contained in:
Jonathon Anderson
2023-04-14 18:34:03 -06:00
parent a10fdb3808
commit 387cd0f7be
8 changed files with 42 additions and 68 deletions

View File

@@ -42,7 +42,7 @@ nodes:
_, warewulfConfErr = tempWarewulfConf.Write([]byte(conf_yml))
assert.NoError(t, warewulfConfErr)
assert.NoError(t, tempWarewulfConf.Sync())
warewulfconf.ConfigFile = tempWarewulfConf.Name()
warewulfconf.New().Read(tempWarewulfConf.Name())
tempNodeConf, nodesConfErr := os.CreateTemp("", "nodes.conf-")
assert.NoError(t, nodesConfErr)