Commit Graph

117 Commits

Author SHA1 Message Date
Jonathon Anderson
cac6ae1cd0 Fix wwlog.Output format strings during overlay show
Signed-off-by: Jonathon Anderson <janderson@ciq.com>
2024-09-26 10:48:40 -06:00
Jonathon Anderson
053dd9953a Split overlays into discrete functionality and test
- Closes #987

To make the overlays testable in isolation, and after discussion with
the TSC, removed host/time/source from overlay files.

Signed-off-by: Jonathon Anderson <janderson@ciq.com>
2024-09-26 10:48:38 -06:00
Tobias Ribizel
c6b6caeb0b fix lint warnings
Signed-off-by: Tobias Ribizel <mail@ribizel.de>
2024-09-16 12:55:27 +02:00
Tobias Ribizel
7692babd76 Return error code if overlay build fails
Signed-off-by: Tobias Ribizel <mail@ribizel.de>
2024-09-15 01:43:53 +02:00
Jonathon Anderson
f39972f917 Prevent overlays from being improperly used as format strings
`wwctl overlay show --render` shows the rendered overlay with
`wwlog.Info`, but that caused it to be processed as a format string.
This passes an explicit format string first, and then includes the
rendered overlay as a variable to the formatter.

- Fixes #1363

Signed-off-by: Jonathon Anderson <janderson@ciq.com>
2024-09-06 15:01:49 +02:00
Christian Goll
c9c38542f4 added completion to overlay chmod/chown/delete/edit
Signed-off-by: Christian Goll <cgoll@suse.com>
2024-08-02 13:55:56 -06:00
xu yang
cec903aeeb resovle the comments
Signed-off-by: xu yang <xyang@ciq.com>
2024-07-25 06:42:16 +00:00
xu yang
62d9b5f71d fix the failure when updating overlay files existing on different partitions
Signed-off-by: xu yang <xyang@ciq.com>
2024-07-25 02:29:29 +00:00
Christian Goll
4a4fcc97d4 wwctl overlay list completes existing overlays
Signed-off-by: Christian Goll <cgoll@suse.com>
2024-07-05 15:17:23 -06:00
xu yang
371e4d63a6 Fix multiple issues in wwctl overlay edit
- Fixes #1236
- Fixes #1235

Signed-off-by: xu yang <xyang@ciq.com>
2024-07-03 17:57:25 -06:00
Christian Goll
5c23a4cdde added {{ .Overlay }} to templates
{{ .Overlay }} contains the overlay name in which the template is
located, or an empty string if RenderTempalte is called outside the
warewulf overlay tree.

- Closes #1052

Signed-off-by: Christian Goll <cgoll@suse.com>
2024-04-17 21:40:32 -06:00
Xu Yang
2d1a39a3ee add support for rendering host tempalte
Signed-off-by: Xu Yang <xyang@ciq.com>
2024-03-25 00:55:35 -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
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
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
c8604bc200 Remove testenv.WriteFileAbs
Writing absolute file names in testenv breaks safety that files in the
test environment are written to the designated temporary path. Adjusted
the relevant tests to use testenv.WriteFile.

Signed-off-by: Jonathon Anderson <janderson@ciq.com>
2023-11-25 23:54:44 -07:00
Christian Goll
5d25b3a4a6 added explicit tests for overlay commands
Signed-off-by: Christian Goll <cgoll@suse.com>
2023-11-25 01:54:02 -07:00
Jonathon Anderson
4f41a569dd Replace development with main
The development branch has been replaced with the main branch in GitHub.
Replaces references to development in docs, commands, configuration, and
workflows.

Signed-off-by: Jonathon Anderson <janderson@ciq.com>
2023-11-25 00:27:52 -07: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
ff7608251a advanced command line completion for wwctl overlay
Signed-off-by: Christian Goll <cgoll@suse.com>
2023-09-13 12:03:43 +02:00
Jonathon Anderson
7e4e2a3f71 Fix and update initial overlay template
Signed-off-by: Jonathon Anderson <janderson@ciq.com>
2023-08-31 17:44:46 -06:00
Jonathon Anderson
fb49b6082e Update overlay edit with tempfile and mtime
The recent `overlay edit` command reimplementation included some
incorrect ordering that led to spurious error messages for files that
did not yet exist. This reimplementation reorders operations to avoid
such error messages and clarifies the implementation by editing in a
temporary file and using mtime to discern whether an edit has occurred.

Signed-off-by: Jonathon Anderson <janderson@ciq.com>
2023-08-31 15:55:18 -06:00
Christian Goll
a7df560a30 Add json output for ignition
Signed-off-by: Christian Goll <cgoll@suse.com>
2023-08-21 16:19:13 -06:00
John Hanks
6a53b9aa19 Replace deprecated io.ioutil functions with new os versions. 2023-07-25 18:54:06 -05:00
jason yang
869d3d7c76 squash commits
Signed-off-by: jason yang <jasonyangshadow@gmail.com>
2023-05-15 10:31:07 +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
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
Christian Goll
2c9a241643 Merge pull request #683 from hpcng/overlayEdit
make output less scary for new files
2023-02-24 15:15:46 +01:00
Christian Goll
e64b370e73 Merge pull request #673 from mslacken/Fix523
build host overlay only if requested
2023-02-24 15:11:31 +01:00
Jonathon Anderson
cf68113c28 Merge pull request #667 from anderbubble/485-fix-overlay-ls-header
Correct header for overlay list -al
2023-02-18 23:23:13 -07:00
Christian Goll
77352fe36f removed unused flag for import 2023-02-13 12:27:47 +01:00
Christian Goll
5ed711490d remove list files option from edit 2023-02-13 11:25:35 +01:00
Christian Goll
d91f552473 make output less scary for new files 2023-02-13 11:11:19 +01:00
Jonathon Anderson
e8e9c4f3bd Merge branch 'development' into lint-update 2023-02-02 14:38:33 -07:00
Christian Goll
e4eabd036e build host overlay only if requested 2023-02-01 11:35:00 +01:00
Jonathon Anderson
db35d5a5e7 Correct header for overlay list -al
Fixes #485

Signed-off-by: Jonathon Anderson <janderson@ciq.co>
2023-01-31 11:59:40 -07:00
Jonathon Anderson
78b857a3e4 Whitespace cleanup
Removes trailing whitespace from all source files.

Signed-off-by: Jonathon Anderson <janderson@ciq.co>
2022-12-08 18:59:56 -07:00
Christian Goll
5413eb611d removed stray debug line 2022-10-27 12:08:32 +02:00
Christian Goll
721a52239f opening file with twi seperate descriptors 2022-10-27 12:03:10 +02:00
Christian Goll
21f7a1f8c3 fix linting 2022-10-27 11:32:30 +02:00
mslacken
12efa0cc68 check if new template file was modified 2022-10-14 18:18:58 +02:00
mslacken
ab0ee87629 updated linter and fixed deprecated stuff 2022-10-14 17:40:16 +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
fd2fa9c027 Fix argument handling for overlay show rendering
Error logging for overlay show rendering incorrectly checked
the overlay name rather than the path to the file. It also
used wwlog (which goes to stderr) to output the render. This
commit replaces explicit args[] references with their named
equivalents from earlier in the function, correcting those
references along the way, and outputs the final render with
fmt.Print.
2022-09-16 22:39:51 +00: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
Jonathon Anderson
e2b5350834 Fix handling of uid and gid arguments during chown
It appears that the intended behavior of overlay chown was changed
in 00d8d42e9, but the argument handling was not updated to reflect
the removal of overlayKind. This led to a crash when only the
uid was specified, and a processing of the gid as the uid
otherwise.

Signed-off-by: Jonathon Anderson <janderson@ciq.co>
2022-09-11 00:38:05 -06:00
Jonathon Anderson
4bda8cd29e Don't change unspecified gid to 0 during chown
Specifying 0 for gid as a default during chown causes the
gid to be changed to 0 when left unspecified. Changing the
default value to -1 causes the gid to be left unmodified
when unspecified, which is a less surprising behavior.

Signed-off-by: Jonathon Anderson <janderson@ciq.co>
2022-09-10 14:51:56 -06:00
Christian Goll
d976e7fc31 Merge pull request #467 from mslacken/single-Overlay
enable overlay rendering
2022-06-24 09:50:14 +02:00