Use state-based routing instead of sentinel strings, so whitespace-trimming
syntax (e.g. `{{- file "name" -}}`) correctly creates all named files and
symlinks.
Fixes: #2118
Signed-off-by: Jonathon Anderson <janderson@ciq.com>
Co-authored-by: Christian Goll <cgoll@suse.com>
Signed-off-by: Jonathon Anderson <janderson@ciq.com>
Rendering overlay templates requires fetching and populating / merging all
other nodes, because overlay templates have access to all cluster node info.
This was previously being done for each template render, but is not being done
once for each render operation and re-used for each template render.
Signed-off-by: Jonathon Anderson <janderson@ciq.com>
site overlays are place in sysconfdir/overlays and take
precedence over distribution overlays with the same name.
Every `wwctl overlay` command changing overlays will create
an site overlay. distribution overlays can't be deleted or
modified with wwctl.
Signed-off-by: Christian Goll <cgoll@suse.com>
- 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>
`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>
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>
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.
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>