Commit Graph

128 Commits

Author SHA1 Message Date
Christian Goll
242276bba9 fixed tests and added explcit error handling
Signed-off-by: Christian Goll <cgoll@suse.com>
2023-10-25 22:35:49 -06:00
Christian Goll
e90616cafb calling the overlay build functions direclty
The warewulfd process called `wwctl build -O [system|runtime] node`
if autobuild was set. This created [system|runtime].img which isn't
supported with the build model. Calling now BuildOverlay directly

Signed-off-by: Christian Goll <cgoll@suse.com>
2023-10-25 22:35:45 -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
9cf47da963 Fix warewulfd for new contextual overlay names
The recent PR #883 replaced the standard overlay naming convention with
static names for each of the runtime and wwinit/system contexts; but the
method by which it left the "legacy" naming convention in place led to a
bug where warewulfd was still attempting to serve overlays with the
previous naming convention, though this name wasn't being built.

This PR refactors contextual overlay image naming to be, I think, a more
typical golang pattern, and updates affected code to match.

This PR also included tests for all functions modified by this change.

Fixes #896

Signed-off-by: Jonathon Anderson <janderson@ciq.com>
2023-09-02 11:18:38 -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
griznog
13c426de1c Add an argument to the runtime/system overlay related functions to carry the context to getOverlayFile() for building the img name. 2023-07-27 07:27:20 -05:00
Jonathon Anderson
4622153a82 Support subdirectories in ipxe paths
Signed-off-by: Jonathon Anderson <janderson@ciq.co>
2023-04-19 14:02:43 -06:00
Jonathon Anderson
e8e9c4f3bd Merge branch 'development' into lint-update 2023-02-02 14:38:33 -07:00
David McFarlane
950099f9dc Set umask to 0000 while overlays are being built. Fixes #584 2023-01-18 14:34:40 +11:00
Jonathon Anderson
15879eb991 Use node.NewInfo constructor in configure hostfile
Also used in overlay, as I was looking there already.

Signed-off-by: Jonathon Anderson <janderson@ciq.co>
2022-11-11 11:42:40 -06:00
Logan Harbour
99ec5acb59 Fix typos 2022-11-08 09:53:22 -07: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
Christian Goll
6cc58fcfff Merge pull request #534 from anderbubble/wwlog-printf-cleanup
Replace all instances of wwlog.Printf
2022-09-14 08:18:44 +02:00
Christian Goll
2352aa0d51 Merge pull request #477 from mslacken/configure-hostfile
readded configure hostfile command
2022-09-13 11:26:23 +02: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
cd8b0d86c5 Fix a typo in symlink wwbackup implementation
Signed-off-by: Jonathon Anderson <janderson@ciq.co>
2022-09-02 15:40:45 -06:00
Christian Goll
ed21052462 readded configure hostfile command 2022-06-27 11:50:27 +02:00
Christian Goll
d976e7fc31 Merge pull request #467 from mslacken/single-Overlay
enable overlay rendering
2022-06-24 09:50:14 +02:00
Gregory M. Kurtzer
4d44d3a299 Merge pull request #438 from kcdodd/fix/srvdisco
Fix server thread safety of discoverable node and overlay build
2022-06-09 22:18:23 -07:00
Christian Goll
9e5b2d1aa3 added the wwctl overlay parse command
The `wwctl overlay parse -n NODE FILE` will interpret the given overlay file and print it stdout, via wwlog.PRINTF.
The overlay code had to be refactored for this, but hopefully this makes the code a bit more readable. Also the tstruct has not its own initilization code.
2022-06-08 15:10:46 +02:00
Christian Goll
dfe3f907b9 moved TemplateStruct init to own function 2022-06-08 15:10:43 +02:00
Christian Goll
1b02c89ca7 moved overlay parsing to own function 2022-06-08 15:08:43 +02:00
Christian Goll
ecea7a949f create symlink if target exists 2022-06-08 10:56:42 +02:00
Carter Dodd
fc8d3863d8 use wwctl to re-build provision overlays, update to pass overlaynames 2022-06-04 11:14:48 -05:00
Gregory Kurtzer
e188edcf7a gofmt cleanup 2022-05-25 14:17:01 -07:00
Carter Dodd
a36467b2a8 Merge upstream 2022-05-13 19:42:18 -05:00
Carter Dodd
379faad51d Refactor of server, logging, building of images, template updates
* Combine provision response handling, add hwaddr and interface to dhcp
* Simplify stage cases, add backward compatible uri parse
* Move control of image compression to client
* Fix kernel search path for ubuntu, buffer template generation
* Implement cpio and gz as functions, add log named functions
* Generalize fs image creation routine
* Combine daemonLogf to generalized wwlog
* Fix template newline insertion, update dhcp and hosts tmpl
* Update IPXE template to handle non-compressed files
* Update DHCP template to set network interfaces and server IP assignment
* Update DHCP/hosts templates to choose a host-name self-consistently
2022-05-13 16:52:59 -05:00
Christian Goll
9c21f2bade Merge pull request #419 from jcsiadal/nodefault
Renames instances of "Default" to "Primary" in netdev source code
2022-05-12 11:58:47 +02:00
Christian Goll
121c12b5e4 Readd BuildTimeUnix 2022-05-05 16:15:06 +02:00
Christian Goll
de819b5583 only add split function in templates 2022-05-05 16:13:01 +02:00
jcsiadal
9b6b93a5cb Rename default to primary in src
Signed-off-by: jcsiadal <jeremy.c.siadal@intel.com>
2022-05-05 03:13:21 +00:00
Christian Goll
7ce286ac3e updated overlay includes mire vars and split func 2022-05-03 14:52:17 +02:00
griznog
bada0f738b Add BuildTimeUnix containing Unix time (seconds since epoch). 2022-04-15 10:36:40 -05:00
Christian Goll
469e731adb Merge pull request #385 from mslacken/network-cidr
add NetworkCIDR for overlays
2022-04-14 13:57:23 +02:00
Christian Goll
e29aea8ae3 using stirng for ipmiwrite storage 2022-04-14 12:50:38 +02:00
Christian Goll
5adc0e3093 add NetworkCIDR for overlays 2022-04-13 20:19:35 +02:00
griznog
75e075ab52 Ignore dotfiles when building overlay list. 2022-04-11 11:15:25 -05:00
Christian Goll
38b166945a reservre meomory for tempalte struct 2022-04-08 17:34:52 +02:00
Christian Goll
0ef96c575d Added SEC prefix for wwlog levels
This SEC-levels are meant for internal documentation of security
relevant messages so that this code sections are marked.
2022-04-07 11:05:00 +02:00
Christian Goll
95d1b23921 use secure overlay dir
If there is a user writeable file in the host overlay, a user can
create arbitrary files on the host root file system. Although these
files will belong to this user, this might allow users to modify
any files.
So this patch restricts the access to the host overlay to root and
produces a warning if this was changed.
2022-04-07 11:05:00 +02:00
Christian Goll
95050a44ce add user defined keys for networks/netdev
Every network in the profile and for the nodes can have induvidual keys values
pairs, called Tags, which are propergated to the templates. So they can be used
for things like MTU size like
  `wwct node set node01 --nettag mtu=9000`
and in in ifcfg.xml.ww
```
{{ if $netdev.Tags.mtu -}}
<mtu> {{ $netdev.Tags.mtu }} </mtu>
{{ end -}}
```
2022-04-06 21:36:17 +02:00
jcsiadal
bfde70cf8a Error free lint
Signed-off-by: jcsiadal <jeremy.c.siadal@intel.com>
2022-04-04 17:01:11 +00:00
Christian Goll
175e387f63 removed unused varaible 2022-03-30 17:54:13 +02:00
Christian Goll
ab32625e7a refactored template processing functions 2022-03-30 17:11:03 +02:00
Christian Goll
c0f7ecf357 store the ovelats as yaml list 2022-03-24 19:45:51 +01:00
Christian Goll
baae8324c9 add noit always newline on template 2022-03-24 10:59:33 +01:00
Christian Goll
6fab42fda1 do not write master file for templates 2022-03-21 11:59:33 +01:00
Christian Goll
d3b10624b0 Merge branch 'ipv6' 2022-03-18 09:37:23 +01:00
Christian Goll
208baff560 fix regression on overlay image creation 2022-03-17 12:25:38 +01:00