Commit Graph

42 Commits

Author SHA1 Message Date
Jonathon Anderson
59f187bf5e Convert disk booleans from wwbool to *bool
Signed-off-by: Jonathon Anderson <janderson@ciq.com>
2025-09-05 14:16:03 +02:00
Jonathon Anderson
a0179f1432 Resolve issues identifies by staticcheck
Signed-off-by: Jonathon Anderson <janderson@ciq.com>
2025-02-06 22:11:17 -07:00
Jonathon Anderson
73a8ef8e0e Refactor wwctl <node|profile> edit and fix bugs
`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>
2025-01-19 13:02:18 -07:00
Jonathon Anderson
1a3d037703 Refactor GetNode merging with new MergeNode method
- Adds many tests for node+profile merging
- Ensures that tracked fields match mergo results

Signed-off-by: Jonathon Anderson <janderson@ciq.com>
2024-12-25 09:07:28 -07:00
Jonathon Anderson
fdbdf88df0 Rename NodeConf to NodesConf
Signed-off-by: Jonathon Anderson <janderson@ciq.com>
2024-11-11 00:09:02 -07:00
Jonathon Anderson
0665d5dc88 Refactor node
Signed-off-by: Jonathon Anderson <janderson@ciq.com>
2024-11-11 00:08:47 -07:00
Christian Goll
0dd0317740 replaced errors.Wrap with fmt.Errorf
Signed-off-by: Christian Goll <cgoll@suse.com>
2024-11-07 22:57:29 -07:00
Jonathon Anderson
4e9b097eb6 Only output node and profile list headers once
Signed-off-by: Jonathon Anderson <janderson@ciq.com>
2024-11-07 22:44:50 -07:00
Christian Goll
cb9e6e8be0 Removed rest of direct yaml.v2 deps
Signed-off-by: Christian Goll <cgoll@suse.com>
2024-10-25 14:33:57 -06:00
Jonathon Anderson
b331fd12af Remove dead code
Verified with

```
deadcode -test ./...
```

Followed-up with a lint check.

Signed-off-by: Jonathon Anderson <janderson@ciq.com>
2024-10-18 15:09:01 -06:00
Jonathon Anderson
30ac144044 Restored profile list tests and resolved exposed bugs
Signed-off-by: Jonathon Anderson <janderson@ciq.com>
2024-10-17 23:58:37 -04:00
Christian Goll
342236b9b9 updated test for yaml/v3
Signed-off-by: Christian Goll <cgoll@suse.com>
2024-10-17 15:30:54 -04:00
Christian Goll
9ba1aa8d63 api changes to modify unexported fields
changes can now not be done directly but must
go to SetNode or SetProfile. Although its also
now possible to access the field direclty with
GetNodePtr

Signed-off-by: Christian Goll <cgoll@suse.com>
2024-10-17 15:30:54 -04:00
Christian Goll
ac6cd69ca6 fix test to run without NodeInfo
Also removed --fullall from node list and profile list

Signed-off-by: Christian Goll <cgoll@suse.com>
2024-10-17 15:30:47 -04:00
Christian Goll
ffef31969e api changes for use without NodeInfo
Signed-off-by: Christian Goll <cgoll@suse.com>
2024-10-17 13:35:42 -04:00
Tobias Poschwatta
b4e1b9cb24 Fix typo in "profile with name ... already exists" message
Signed-off-by: Tobias Poschwatta <poschwatta@zib.de>
2024-08-30 11:45:43 +02:00
Xu Yang
5956f2e9a1 use marshalindent instead of marshal
Signed-off-by: Xu Yang <xyang@ciq.com>
2024-03-19 03:04:20 -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
Yong Qin
0aca225ef7 Fixed a bug with profile list when kernelargs are set with 'var=val'
format. This also removed the unnecessary '--' for the source profile
since it's never used.
2024-03-11 11:04:21 +01: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
Christian Goll
725176cfed cleanup code after review
Signed-off-by: Christian Goll <cgoll@suse.com>
2024-01-17 18:02:04 -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
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
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
0faada6aae refactor the profile add
Signed-off-by: jason yang <jasonyangshadow@gmail.com>
2023-04-12 10:27:44 +00: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
c476ba8ec4 hash checking for profile edit
Signed-off-by: Christian Goll <cgoll@suse.de>
2023-03-24 19:47:22 +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
Yang Xu
854240075a Merge branch 'development' into issue/661 2023-03-17 18:06:18 +09:00
jason yang
8dc0168412 changing a profile always adds an empty default interface
Signed-off-by: jason yang <jasonyangshadow@gmail.com>
2023-03-17 09:01:51 +00:00
Christian Goll
aec1cb82ae ipmi and kernel fields were missing in ouput 2023-02-16 12:18:04 +01:00
Christian Goll
edce6b8140 refactored profile list command 2023-02-02 12:22:07 +01:00
Christian Goll
4fe584547b Merge branch 'development' into wwlog-newlines 2022-10-13 14:46:03 +02:00
Christian Goll
8e0fd64c7e add profile edit (copy&paste) from node edit 2022-09-19 16:01:36 +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
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
e6ef30ed53 porfile add has now all otions of set 2022-07-15 11:10:12 +02:00
Christian Goll
e0c62a81a4 testing profile set 2022-07-14 10:35:27 +02:00
Christian Goll
14b86a5e8e added profile set over API 2022-07-13 15:56:04 +02:00