Commit Graph

71 Commits

Author SHA1 Message Date
Jonathon Anderson
51786b5e4a Fix a panic during wwctl node list --ipmi for nodes with no ipmi configuration. #1847
Signed-off-by: Jonathon Anderson <janderson@ciq.com>
2025-04-01 16:48:43 -06:00
Rafael Lopez
ca1830d8e1 Rename value in loop
Rename value from 'node' to 'nodeData' so it doesn't
coincide with the package import name.

Signed-off-by: Rafael Lopez <raflopez1@gmail.com>
2025-03-25 19:21:30 -06:00
Rafael Lopez
299f1db41c fix import from yaml where node does not pre-exist
Check if node exists, if not add it first before
attempting SetNode().

Fixes: #1842
Signed-off-by: Rafael Lopez <raflopez1@gmail.com>
2025-03-25 19:21:30 -06:00
Jonathon Anderson
900426ce81 Updated wwctl node export to include node IDs
- Fixed: #1718

Signed-off-by: Jonathon Anderson <janderson@ciq.com>
2025-02-10 13:41:40 -07: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
1f607b679b wwctl node list <--yaml|--json> outputs a map keyed by node name
- Fixes: #1667

Signed-off-by: Jonathon Anderson <janderson@ciq.com>
2025-02-03 12:32:50 +01: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
45a690ca4e Rename "container" to "image"
- Updated `wwctl upgrade` to handle updates
- Maintained `.Container` and `.ContainerName` in tstruct
- Added `ContainerName()` methods to node and profile objects
- Added `--container`, `-C` aliases to wwctl commands (`<node|profile> <add|set>`)
- Added `wwctl container` alias
- Added support for `container_exit.sh` if `image_exit.sh` is not found

Signed-off-by: Jonathon Anderson <janderson@ciq.com>
2025-01-19 05:54:19 -07:00
Jonathon Anderson
dae8d004b3 Use Node literal in MergeNode, not EmptyNode()
EmptyNode populates empty sub-structs, which interferes with omitempty during
serialization.

Signed-off-by: Jonathon Anderson <janderson@ciq.com>
2025-01-18 09:48:26 -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
a844379bc5 Merge --kerneloverride into --kernelversion
Signed-off-by: Jonathon Anderson <janderson@ciq.com>
2024-12-09 10:02:28 +01:00
Jonathon Anderson
e098455f7c Fix display of profiles in node list
- Closes #1496

Signed-off-by: Jonathon Anderson <janderson@ciq.com>
2024-11-25 11:32:03 +01:00
Christian Goll
c0d2e3714c add tag to tags not nettag
Signed-off-by: Christian Goll <cgoll@suse.com>
2024-11-14 17:17:43 -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
3cbb295e7b Remove escape character from IPMI attribute list
This wasn't in the header, and usually wasn't displaying anything
anyway.

Signed-off-by: Jonathon Anderson <janderson@ciq.com>
2024-11-07 22:44:50 -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
Jonathon Anderson
ccb096104a Remove an erroneous colon suffix from a log message
Signed-off-by: Jonathon Anderson <janderson@ciq.com>
2024-10-25 14:58:03 -06: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
Jonathon Anderson
5fbeaa1873 Remove an extraneous tab
Signed-off-by: Jonathon Anderson <janderson@ciq.com>
2024-10-17 15:39:59 -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
Christian Goll
28a7b9fe84 removed NodeInfo and using NodeConf instead
This is a significant change in the undelying data model!

nodeDb, err := node.New()

will result in a structure which contains the on disk
values. Only

nodeDb.FindAllNodes() or nodeDb.GetNode(id) will give
the nodes with its merged in profiles.

Signed-off-by: Christian Goll <cgoll@suse.com>
2024-10-17 13:35:42 -04:00
xu yang
f7c4b32fc2 Fix issue that domain globs not supported during wwctl node delete.
Signed-off-by: xu yang <xyang@ciq.com>
2024-10-11 09:50:48 +00:00
xu yang
f51808bc75 fix issue that pattern matching broken on node set
Signed-off-by: xu yang <xyang@ciq.com>
2024-10-11 02:27:33 +00:00
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
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
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
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
c635fecbc6 Almost missed a : 2023-12-04 22:18:13 +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
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
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
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
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
c14dd3c6d1 check the yaml direclty after unmarshalling 2023-03-23 11:15:50 +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