Commit Graph

231 Commits

Author SHA1 Message Date
xu yang
3f120f2c4b Return non-zero exit code on node sub-commands
Signed-off-by: xu yang <xyang@ciq.com>
2024-09-26 06:15:02 +00:00
Jonathon Anderson
e99e8c3dbb Update use of wwlog.Info to specify a format string
Since wwlog.Info() expect a format string, accidental inclusion of a
format string in the payload causes an error.

See also #1382, #1363

Signed-off-by: Jonathon Anderson <janderson@ciq.com>
2024-09-25 13:49:11 -06:00
xu yang
aa8282ad10 Fix excessive line spacing issue when listing nodes
Signed-off-by: xu yang <xyang@ciq.com>
2024-09-25 13:49:08 -06:00
Jonathon Anderson
4a5c1cad12 Simplified slice ordering fix and extended for runtime overlay
- Extends #1357
- Fixes #1259

Signed-off-by: Jonathon Anderson <janderson@ciq.com>
2024-09-04 19:59:59 -06:00
xu yang
bfa6ad6be8 add test case
Signed-off-by: xu yang <xyang@ciq.com>
2024-09-04 17:10:50 -06:00
Christian Goll
fc80c4745c add various tests for wwctl node list -a
Altough getting and setting values is correct, `wwctl list -a`
will print superseded values as a list and mark them not as
superseded. Tests will fail after this commit.

Signed-off-by: Christian Goll <cgoll@suse.com>
2024-04-19 22:24:54 -06:00
Christian Goll
17a5aaefee added more aliases for wwctl commands
Signed-off-by: Christian Goll <cgoll@suse.com>
2024-03-20 21:11:14 -06:00
Xu Yang
16183e603c add multiple formats support
Signed-off-by: Xu Yang <xyang@ciq.com>
2024-03-19 01:48:08 -06:00
Christian Goll
b3638ac1ff failing test for node list without network
Signed-off-by: Christian Goll <cgoll@suse.com>
2024-02-21 10:34:03 +01:00
Christian Goll
1fca0057d3 updated WW_INTERNAL to 45 for 4.5.x release
Internal version update is necessary as new structures were added,
most obviously the disk, partitions and file system structures.
Old configurations will work as expected.

Signed-off-by: Christian Goll <cgoll@suse.com>
2024-02-16 20:12:51 -07:00
Christian Goll
dcb21af5ba added check if commas can be set
Signed-off-by: Christian Goll <cgoll@suse.com>
2024-02-06 23:16:59 -07:00
xu yang
cd0ef5c4a8 fix the issue when node edit deletes node when warewulfd is not running
Signed-off-by: xu yang <xyang@ciq.com>
2024-01-30 17:10:52 -07:00
xu yang
7746854732 Fix error when editing node
Signed-off-by: xu yang <xyang@ciq.com>
2024-01-30 17:10:52 -07:00
Jonathon Anderson
a1832ad8c1 Complete transfer of Warewulf from HPCng
Warewulf is now being maintained in its own GitHub organization at
github.com/warewulf

Signed-off-by: Jonathon Anderson <janderson@ciq.com>
2024-01-26 21:35:04 -07:00
jason yang
c0b9c0996a move hostlist code into internal folder
Signed-off-by: jason yang <jasonyangshadow@gmail.com>
2024-01-24 22:00:07 -07:00
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
5d6ef1882d Remove whitespace damage
Signed-off-by: Jonathon Anderson <janderson@ciq.com>
2024-01-21 00:18:38 -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
214848c75e Add IPMI escape char functionality 2023-12-04 15:42:01 +01: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
6c344cd5b0 Refactor ww4test to testenv
- Remove global state
- Remove redundant data
- Remove unused functionality (e.g., file permissions)
- Separate directory creation from file writing
- Additional helper functions for file reading and cleanup

Signed-off-by: Jonathon Anderson <janderson@ciq.com>
Signed-off-by: Christian Goll <cgoll@suse.com>
2023-10-13 14:35:28 +02:00
Christian Goll
b5979e41d2 added general testing framework
framework creates all the necessary configuration file for warewulf
under a temporary directory. Individual warewulf.conf and nodes.conf
can be provided.

Signed-off-by: Christian Goll <cgoll@suse.com>
2023-10-11 12:07:28 +02: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
jason yang
40583b4713 fix kernelargs are not printing properly in node list output
Signed-off-by: jason yang <jasonyangshadow@gmail.com>
2023-05-25 01:21:49 +00:00
jason yang
956e1b3569 squah commits
Signed-off-by: jason yang <jasonyangshadow@gmail.com>
2023-05-15 10:27:52 +00:00
jason yang
b5b62206c1 add one more case
Signed-off-by: jason yang <jasonyangshadow@gmail.com>
2023-05-09 06:12:31 +00:00
jason yang
59390b4dda node/profile list syntax doesn't support comma-separated values
Signed-off-by: jason yang <jasonyangshadow@gmail.com>
2023-05-09 05:30:35 +00:00
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