Commit Graph

231 Commits

Author SHA1 Message Date
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
Christian Goll
b00a619746 moved location of defaults.conf
Signed-off-by: Christian Goll <cgoll@suse.de>
2023-03-23 11:10:58 +01:00
Christian Goll
c1e2100322 added a test for wwctl node add
Signed-off-by: Christian Goll <cgoll@suse.de>
2023-03-23 11:10:29 +01:00
Christian Goll
290c6449dd removed getters as configs must exportable
Signed-off-by: Christian Goll <cgoll@suse.de>
2023-03-23 11:09:20 +01:00
Christian Goll
4deae97bc8 make the configuration to be based in warewulf.conf
defaults will be se by the Makefile

Signed-off-by: Christian Goll <cgoll@suse.de>
2023-03-23 11:09:20 +01:00
Christian Goll
d3af143a5b 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-07 17:01:57 +01:00
Christian Goll
07d39c2e49 moved location of defaults.conf
Signed-off-by: Christian Goll <cgoll@suse.de>
2023-03-07 11:49:09 +01:00
Christian Goll
3367b67b9f added a test for wwctl node add
Signed-off-by: Christian Goll <cgoll@suse.de>
2023-03-07 09:05:29 +01:00
Christian Goll
ce43dfa0b7 removed getters as configs must exportable
Signed-off-by: Christian Goll <cgoll@suse.de>
2023-03-06 10:20:00 +01:00
Christian Goll
377702a179 make the configuration to be based in warewulf.conf
defaults will be se by the Makefile

Signed-off-by: Christian Goll <cgoll@suse.de>
2023-03-03 16:02:41 +01:00
Christian Goll
c6b65bc853 set the primary network in NodeInfo not in NetDev
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.
2023-02-10 10:46:01 +01:00
Christian Goll
4f0ad749d1 Merge pull request #639 from mslacken/DefaultNetwork
use default not override for single network entry
2023-02-03 11:54:01 +01:00
Jonathon Anderson
e8e9c4f3bd Merge branch 'development' into lint-update 2023-02-02 14:38:33 -07:00
Jonathon Anderson
cb1726bd40 Minor spelling fix
Signed-off-by: Jonathon Anderson <janderson@ciq.co>
2023-01-31 14:57:27 -07:00
Christian Goll
1df6f6229e Merge pull request #630 from mslacken/GetBfromAltvalue
GetB must not ignore altvalue
2023-01-13 16:28:24 +01:00
Christian Goll
ae4fb41722 without nested if else 2023-01-12 10:37:19 +01:00
Christian Goll
db863b99c5 use default not override for single network entry 2023-01-11 10:08:05 +01:00
Christian Goll
12460caa04 just return negated checks 2023-01-10 16:20:52 +01:00
Christian Goll
626b9769ac also handle default value 2023-01-09 11:57:11 +01:00
Christian Goll
7a88ff239f checking only for false outcome 2023-01-05 11:03:08 +01:00
Christian Goll
09f00b9cac fix typo for opening defaults.conf 2023-01-04 14:23:47 +01:00
Christian Goll
a4a80e0268 GetB must not ignore altvalue 2023-01-04 14:03:02 +01:00
Jonathon Anderson
423e319bf4 Add --- to the head of FallBackConf
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>
2022-12-13 17:48:38 -07:00
Christian Goll
f7b67b93a3 need ipxe template in defaults 2022-11-30 15:33:07 +01:00
Christian Goll
79ed2a33ff added simple test for transformer.go 2022-11-29 14:30:41 +01:00
Christian Goll
53be931f87 fix tests for fransfomer 2022-11-29 10:53:53 +01:00
Christian Goll
35529527bb added init function for empty NodeInfo 2022-11-11 14:59:15 +01:00
Christian Goll
22f9c86c34 create memory for nettags 2022-10-18 10:02:53 +02:00
mslacken
ab0ee87629 updated linter and fixed deprecated stuff 2022-10-14 17:40:16 +02:00
Christian Goll
4fe584547b Merge branch 'development' into wwlog-newlines 2022-10-13 14:46:03 +02:00