`wwctl node edit` appears to not be working properly since MergeNode. This
refactor, partly towards #918, resolves the issues with `node edit` and updates
`profile edit` to match.
Signed-off-by: Jonathon Anderson <janderson@ciq.com>
introduced wwbool and don't export
Nodes and NodeConfs. This requires new
explict Yaml (un)marshaling as the standard
marshaller won't touch these fields
Signed-off-by: Christian Goll <cgoll@suse.com>
This is a significant change in the undelying data model!
nodeDb, err := node.New()
will result in a structure which contains the on disk
values. Only
nodeDb.FindAllNodes() or nodeDb.GetNode(id) will give
the nodes with its merged in profiles.
Signed-off-by: Christian Goll <cgoll@suse.com>
- Closes#987
To make the overlays testable in isolation, and after discussion with
the TSC, removed host/time/source from overlay files.
Signed-off-by: Jonathon Anderson <janderson@ciq.com>
tftp.tftproot was also avlailable under paths.tftdir, removed
paths.tftpdir
warewulfconf.datastore was also availbale under
paths.datadir, remove paths.datadir
Signed-off-by: Christian Goll <cgoll@suse.com>
With eth0 specified as the default interface device, all interfaces by default
were attempted to be renamed to eth0. This didn't break before because device
renaming wasn't working for multiple interfaces in general; but now that it's
fixed, we should no longer be setting a default interface name.
Signed-off-by: Jonathon Anderson <janderson@ciq.com>
setting the ConfigFile (location of nodes.conf) in init()
led to the situation that a configured Paths.Sysconfdir is ignored.
Signed-off-by: Christian Goll <cgoll@suse.com>
Primary network devices are now identified by a per-node attribute,
rather than a per-netdev boolean. While the legacy data can still be
parsed, the argument for setting the per-netdev boolean at the
command-line is no longer available.
Correct behavior is tested.
Signed-off-by: Christian Goll <cgoll@suse.com>
when transforming a NodeInfo struct to a NodeConf (set the NodeConf from
the NodeInfo) nested structures were seperately handled. This means a
there were seperate handles for e.g *Netdevs and *IpmiConfig. The new
getter traverses through the datastucture and sets the right value for a
Entry struct, but calls itself again if a Pointer is detected.
This adds the posiblity to add new nested structures to NodeConf and
NodeInfo without the need of seperately handling them in the transformer
functions.
Signed-off-by: Christian Goll <cgoll@suse.de>
Since BaseConf.New could return a cached BaseConf, rather than always
constructing a new struct, I've renamed it to Get to more accurately
reflect its use. A new New() method is called by Get and always
initializes a new struct.
Signed-off-by: Jonathon Anderson <janderson@ciq.co>
The caching functionality of nodes.conf, and the optional persistence
functionality that came with it, appears to have been preventing
actually writing the configuration to disk in all cases. This change
fixes the ability to write to nodes.conf.
Somewhat opinionatedly, this change removes the caching functionality of
nodes.conf. The tests have also been updated to use real files for i/o
rather than tying into the caching system, making them more accurately
test the ability of Warewulf to actually read and write its
configuration.
Fixes#779
Signed-off-by: Jonathon Anderson <janderson@ciq.co>
check also MAC addresses and common formating
Signed-off-by: Christian Goll <cgoll@suse.de>
reformat ipaddr for test coverage
fixed processing of default values
updated transformer tests
correct behavior for tags
add tests for tags
new tests for primary network
Signed-off-by: Christian Goll <cgoll@suse.de>
Prior the primary was a boolean attribute of NetDev, so several
NetDevs could have been primay. Setting is as a sting in NodeConf
assures that only one network could be primary.
If no primary network is set, a valid altvalue will be set.
Why have I done this?
- Because defaults.conf had a starting newline, which bugs me.
- Because moving the first line of FallBackConf looks unlovely.
- Because yaml happens to have a --- document-start syntax.
I completely agree that this is (hopefully) a no-op change;
but if anyone else thinks it makes things aesthetically more
pleasing, and agrees that it doesn't break anything, go ahead
and merge. ^_^
Signed-off-by: Jonathon Anderson <janderson@ciq.co>
Apperently the rules in /etc/systemd/network are not
honored by NetworkManager which loads earlier than
systemd-networkd, so adding a rule for NetworkManager