Commit Graph

260 Commits

Author SHA1 Message Date
jason yang
d0b396b89c fix tag ignored issue
Signed-off-by: jason yang <jasonyangshadow@gmail.com>
2024-01-24 15:25:48 -07:00
Jonathon Anderson
a602971146 Avoid reporting an empty "from" value
Signed-off-by: Jonathon Anderson <janderson@ciq.com>
2024-01-17 23:12:35 -07:00
Christian Goll
d6ef1a86ce prpfiles can be exluded with ~ prefix
Used the ~ as prefix as ! will mess up with yaml syntax

Signed-off-by: Christian Goll <cgoll@suse.com>
2024-01-17 22:04:05 -07:00
Christian Goll
85eaa20708 overlays from different profiles are merged
If a node contains several profiles and these profiles have
overlays attached, these profiles are now merged. Overlays
can't be excluded as this can not be displayed to the user

Signed-off-by: Christian Goll <cgoll@suse.com>
2024-01-17 21:51:05 -07:00
Christian Goll
4379c4c18d use grub/shim from host system
Also the boot method is now configured globaly as this is
the only way to make sure that unkonwn nodes get the right
stuff

Signed-off-by: Christian Goll <cgoll@suse.com>
2024-01-17 18:02:04 -07:00
Christian Goll
60dc8f6251 enable grub boot for all nodes
Signed-off-by: Christian Goll <cgoll@suse.com>
2024-01-17 18:02:04 -07:00
Christian Goll
03ef7447e9 copy shim/grub on default profile container change
Signed-off-by: Christian Goll <cgoll@suse.com>
2024-01-17 18:02:04 -07:00
Christian Goll
2fe98e5f55 default profile needs to have a container
Signed-off-by: Christian Goll <cgoll@suse.com>
2024-01-17 18:02:04 -07:00
Christian Goll
a36cb23319 added shim/grub find to provision process
Signed-off-by: Christian Goll <cgoll@suse.com>
2024-01-17 18:02:04 -07:00
Jonathon Anderson
feeb6211af Remove device: eth0 from dummy interface
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>
2023-12-21 22:11:44 -07:00
Christian Goll
8323cb8aa7 moved initialization of ConfigFile to New()
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>
2023-12-09 01:47:15 -07:00
Jonathon Anderson
64d0d54c92 Fix some formatting errors with make fmt
Signed-off-by: Jonathon Anderson <janderson@ciq.com>
2023-12-08 21:18:14 -07:00
Andreas Skau
663f2e64ec Removed deprecated Sets as requested in PR#999 2023-12-04 22:08:06 +01:00
Andreas Skau
10976a7e5d Delinted 2023-12-04 15:58:26 +01:00
Andreas Skau
214848c75e Add IPMI escape char functionality 2023-12-04 15:42:01 +01:00
Christian Goll
f8805e87a4 merge tags in GetterFrom
Signed-off-by: Christian Goll <cgoll@suse.com>
2023-11-25 01:54:02 -07:00
Christian Goll
7f502c1f8a added test for tag from profile
Signed-off-by: Christian Goll <cgoll@suse.com>
2023-11-25 01:54:02 -07:00
Jonathon Anderson
42842aeee1 Format entire source code using make fmt
Signed-off-by: Jonathon Anderson <janderson@ciq.com>
2023-10-23 17:56:20 -06:00
Christian Goll
539002088c check if entry has real value in recursive getter
Signed-off-by: Christian Goll <cgoll@suse.com>
2023-10-14 02:52:53 -06:00
Christian Goll
a7056e2bb8 mtu can be set via command line
added also a test for this

Signed-off-by: Christian Goll <cgoll@suse.com>
2023-10-14 02:09:06 -06:00
Jonathon Anderson
f9cdda1ee9 Add tests for FindDiscoverableNode
Signed-off-by: Jonathon Anderson <janderson@ciq.com>
2023-10-10 22:40:23 -06:00
Christian Goll
84d2389aaf return the primary network interface for discoverd
close #775

Signed-off-by: Christian Goll <cgoll@suse.com>
2023-10-10 22:40:02 -06:00
Christian Goll
ff7608251a advanced command line completion for wwctl overlay
Signed-off-by: Christian Goll <cgoll@suse.com>
2023-09-13 12:03:43 +02:00
Christian Goll
c3a4eba514 Disable per-netdev primary flag
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>
2023-09-13 11:31:04 +02:00
Jonathon Anderson
9058682b18 Add tests for disk data and ignition json
Signed-off-by: Jonathon Anderson <janderson@ciq.com>
2023-08-22 14:28:02 -06:00
Christian Goll
a7df560a30 Add json output for ignition
Signed-off-by: Christian Goll <cgoll@suse.com>
2023-08-21 16:19:13 -06:00
Christian Goll
45539a0d1f Recursive handling for command line flags
Every struct in a NodeConf with `lopt:"foo" set is now added as a
command-line flag with the RecursiveCreateFlags call. For maps a struct
with the key UNDEF is added so that it can be parsed out.

As the flags for the command-line need variables which hold the values,
for every map an element map[UNDEF] is added.  When now calling the
internal add, these map element can be filtered out and replace by the
given name. (e.g., --netname)

* rewrote node/profile add for recursive functions
* rewrote node/profile set for recursive functions
* rewrote node/profile list for recursive functions

Signed-off-by: Christian Goll <cgoll@suse.com>
2023-08-21 16:19:13 -06:00
Christian Goll
c55c5a2ac4 Add recursive setter functions
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>
2023-08-21 16:19:13 -06:00
Christian Goll
fdd233a25f Add recursive getter functions
When transforming a NodeConf struct to a NodeInfo (get the NodeInfo from
the Nodconf) nested structures were seperately handled. This means there
were seperate handles for e.g *Netdevs and *IpmiConfig. The new getter
traverses through the datastucture and sets the right value for an 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 seperate handling them in the transformer
functions.

Signed-off-by: Christian Goll <cgoll@suse.de>
2023-08-21 16:19:13 -06:00
Christian Goll
f2bc70ad00 Add structures for devices and filesystems
Signed-off-by: Christian Goll <cgoll@suse.de>
2023-08-21 16:19:13 -06:00
Christian Goll
4d50f053d7 Minor test fixes
Signed-off-by: Christian Goll <cgoll@suse.de>
2023-08-21 16:19:13 -06:00
jason yang
15d4ccb34d add sort support for returned slice
Signed-off-by: jason yang <jasonyangshadow@gmail.com>
2023-05-12 02:47:53 +00:00
Jonathon Anderson
ab52e389f6 Merge pull request #781 from anderbubble/config-refactor
Refactor package that handles warewulf.conf
2023-04-26 13:56:03 -06:00
Christian Goll
8b552fe5ca make onboot default for network devices
Signed-off-by: Christian Goll <cgoll@suse.de>
2023-04-21 08:38:15 +02:00
Jonathon Anderson
70292276e2 Rename BaseConf.New to BaseConf.Get
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>
2023-04-19 14:02:43 -06:00
Jonathon Anderson
c461e65a98 Rename pkg/warewulfconf to pkg/config
Signed-off-by: Jonathon Anderson <janderson@ciq.co>
2023-04-19 14:02:43 -06:00
Jonathon Anderson
e693ca9cd4 Merge remote-tracking branch 'jason/issue/658' into development
Signed-off-by: Jonathon Anderson <janderson@ciq.co>
2023-04-16 18:43:59 -06:00
Jonathon Anderson
cc714008ef Add doc comments for two methods
Signed-off-by: Jonathon Anderson <janderson@ciq.co>
2023-04-16 07:24:14 -06:00
Jonathon Anderson
2319906d97 Fix writing of nodes.conf
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>
2023-04-14 10:53:31 -06:00
jason yang
0faada6aae refactor the profile add
Signed-off-by: jason yang <jasonyangshadow@gmail.com>
2023-04-12 10:27:44 +00:00
Christian Goll
5f5724c8a9 Merge branch 'development' into RefactorFlags 2023-04-11 14:17:13 +02:00
Christian Goll
c476ba8ec4 hash checking for profile edit
Signed-off-by: Christian Goll <cgoll@suse.de>
2023-03-24 19:47:22 +01:00
Christian Goll
b4acf0fdf2 added hash check for node edit
Signed-off-by: Christian Goll <cgoll@suse.de>
2023-03-24 19:47:22 +01:00
Christian Goll
ee4f9d53d6 add hash function
Signed-off-by: Christian Goll <cgoll@suse.de>
2023-03-24 19:47:22 +01:00
Christian Goll
e27ee11f16 fixed wrong converter for bools
Signed-off-by: Christian Goll <cgoll@suse.de>
2023-03-23 11:17:54 +01:00
Christian Goll
96644be621 allow UNSET for IP addresses
added more tests for GetFrom
allow UNSET and handle empty hwaddr

Signed-off-by: Christian Goll <cgoll@suse.de>
2023-03-23 11:17:38 +01:00
Christian Goll
b0602133ec use netParseIP and ParseMAC
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>
2023-03-23 11:17:07 +01:00
Christian Goll
c14dd3c6d1 check the yaml direclty after unmarshalling 2023-03-23 11:15:50 +01:00
Christian Goll
13bc378a6b Refactor the CreateFlags command
* added the additional type flag, which can be bool,IP
* UNDEF is recognized for the bool flag
* 0.0.0.0 must be used as UNDEF for IP flag

Signed-off-by: Christian Goll <cgoll@suse.de>
2023-03-23 11:15:50 +01:00
Christian Goll
4750f96cc6 main_tests are not working as expected
The global values which store the flags are not regenerated during test

Signed-off-by: Christian Goll <cgoll@suse.de>
2023-03-23 11:11:01 +01:00