Commit Graph

202 Commits

Author SHA1 Message Date
Jonathon Anderson
82520c0de0 Fix linter errors in some tests
Signed-off-by: Jonathon Anderson <janderson@ciq.co>
2023-04-19 14:02:43 -06:00
Jonathon Anderson
387cd0f7be 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>
2023-04-19 14:02:43 -06: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
b6e6795dee Removed "glob" from node pattern description
A glob is a pattern that supports * and ? wildcards. This is not
supported for node patterns. I'd call these "hostlist" patterns; but
easier to just leave it generic for now until and unless there is
documentation to refer to on the website about the pattern type.

Signed-off-by: Jonathon Anderson <janderson@ciq.co>
2023-04-16 20:58:39 -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
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
Christian Goll
5f5724c8a9 Merge branch 'development' into RefactorFlags 2023-04-11 14:17:13 +02:00
Christian Goll
48c08f3fd7 Merge pull request #719 from hpcng/hashConf
more secure edit command
2023-04-11 11:44:01 +02:00
Christian Goll
7265083ed0 added test for node list
Signed-off-by: Christian Goll <cgoll@suse.com>
2023-03-28 20:56:12 +02:00
jason yang
6f200d65a6 Merge branch 'development' into issue/690 2023-03-28 07:09:33 +00: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
366113bf65 Merge branch 'RefactorFlags' into development
Signed-off-by: Christian Goll <cgoll@suse.de>
2023-03-23 11:24:47 +01:00
Christian Goll
12e462afa1 added parsing tests
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
2410a8194c wwctl node add without global variables
Signed-off-by: Christian Goll <cgoll@suse.de>
2023-03-23 11:11:01 +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
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
6b510865fe added warewulfconf as command line parameter
the environment variable WAREWULFCONF is also recognized

Signed-off-by: Christian Goll <cgoll@suse.de>
2023-03-23 11:09:20 +01:00
jason yang
522c3478fb use tablewriter to format the output
Signed-off-by: jason yang <jasonyangshadow@gmail.com>
2023-03-23 02:44:59 +00:00
Christian Goll
d34e496d42 wwctl node add without global variables
Signed-off-by: Christian Goll <cgoll@suse.de>
2023-03-08 12:33:05 +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
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
78978ad233 added warewulfconf as command line parameter
the environment variable WAREWULFCONF is also recognized

Signed-off-by: Christian Goll <cgoll@suse.de>
2023-03-03 11:18:49 +01:00
Jonathon Anderson
e8e9c4f3bd Merge branch 'development' into lint-update 2023-02-02 14:38:33 -07:00
Jonathon Anderson
5b50ef724c Fix 'nodes' alias for 'node' not 'profile'
Fixes #609

Signed-off-by: Jonathon Anderson <janderson@ciq.co>
2023-01-06 14:17:46 -07:00
Christian Goll
0e6223b6f8 do not confirm deleting zero nodes
close #603

Signed-off-by: Christian Goll <cgoll@suse.de>
2022-12-22 14:48:58 +01: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
Christian Goll
98e942e092 add simple node export 2022-10-13 10:13:31 +02:00
Christian Goll
f1bad3bc39 Added csv import of nodes 2022-10-10 11:06:30 +02:00
Christian Goll
ddf72b6b09 import nodes from file 2022-09-23 15:49:40 +02:00
Christian Goll
a4fbe428e2 only show options with lopt 2022-09-23 14:47:17 +02:00
Christian Goll
3cc9e12e69 add yaml strings as comment 2022-09-19 15:23:33 +02:00
Christian Goll
7c453066fa add short check if config can be written 2022-09-19 11:09:36 +02:00
Christian Goll
54dd8b3d2f linter fixes as some errors may not really occur 2022-09-16 17:02:17 +02:00
Christian Goll
7087f3e4a1 add edit command for direct edit of node entries 2022-09-16 16:51:07 +02:00
Jonathon Anderson
0b3e862bea Remove trailing newline from wwlog
I noticed that some wwlog calls included a trailing newline, but others
did not. I tested both in isolation and discovered that the behavior was
consistent regardless of whether a trailing newline was included. I
further confirmed in code that wwlog appends a trailing newline
automatically if it is not present; so a trailing newline is unnecessary
in individual calls.

This commit removes trailing newlines from all calls to make them
consistent. It also replaces two calls to wwlog.Printf. (see #534)

Signed-off-by: Jonathon Anderson <janderson@ciq.co>
2022-09-15 12:38:03 -06:00
Jonathon Anderson
22910958b5 Replace all instances of wwlog.Printf
wwlog provides named loggers for each level, which requires
less code and is clearer than wwlog.Printf. The code has
included a mix of both, but this commit consolidates existing
code on the per-level functions.

Signed-off-by: Jonathon Anderson <janderson@ciq.co>
2022-09-11 08:00:23 -06:00
Christian Goll
18eb531d4b fixed deletion of network and deletion of tags 2022-09-02 16:45:37 +02:00
Christian Goll
255ff61dc8 adding netname option back 2022-08-31 17:05:28 +02:00
Christian Goll
b485ea999f removed optionStrMap in favor of NodeConf
openStrMap is a map[string]string which is sent arround. This is now
done by using a unmarshalled NodeConf instead.
2022-08-18 19:22:55 +02:00
Christian Goll
41d12888ab reflections for unmarshal 2022-08-10 14:16:48 +02:00
Christian Goll
ed5b2bbf35 using tag instead of key 2022-08-03 13:44:12 +02:00
Christian Goll
96731a4b87 node list imporvement 2022-08-03 11:47:25 +02:00
Christian Goll
925a5a2155 Fix node set 2022-07-26 12:01:13 +02:00
Christian Goll
d252b974bf Fix Nodeadd with ipaddr count 2022-07-21 08:41:36 +02:00