From 2cb546538deee70ea0a77a568266c9ab315369401f64f405066f5f30cae252fa Mon Sep 17 00:00:00 2001 From: Christian Goll Date: Thu, 11 Jul 2024 09:10:17 +0000 Subject: [PATCH] Accepting request 1186801 from home:mslacken:pr * be more verbose if container is rebuild (bsc#1227646) * verbose-exec.patch OBS-URL: https://build.opensuse.org/request/show/1186801 OBS-URL: https://build.opensuse.org/package/show/network:cluster/warewulf4?expand=0&rev=82 --- fix-overlay-built.patch | 34 +++++++++++++++++----------------- verbose-exec.patch | 26 ++++++++++++++++++++++++++ warewulf4.changes | 2 ++ warewulf4.spec | 1 + 4 files changed, 46 insertions(+), 17 deletions(-) create mode 100644 verbose-exec.patch diff --git a/fix-overlay-built.patch b/fix-overlay-built.patch index 7f7dfc5..459cc69 100644 --- a/fix-overlay-built.patch +++ b/fix-overlay-built.patch @@ -1,17 +1,17 @@ -diff --git a/internal/pkg/warewulfd/provision.go b/internal/pkg/warewulfd/provision.go -index 51b8d60e..abfb3275 100644 ---- a/internal/pkg/warewulfd/provision.go -+++ b/internal/pkg/warewulfd/provision.go -@@ -145,6 +145,12 @@ func ProvisionSend(w http.ResponseWriter, req *http.Request) { - request_overlays = strings.Split(rinfo.overlay, ",") - } else { - context = rinfo.stage -+ switch context { -+ case "system": -+ request_overlays = node.SystemOverlay.GetSlice() -+ case "runtime": -+ request_overlays = node.RuntimeOverlay.GetSlice() -+ } - } - stage_file, err = getOverlayFile( - node, +diff --git a/internal/pkg/warewulfd/util.go b/internal/pkg/warewulfd/util.go +index 1211beb5..d955f772 100644 +--- a/internal/pkg/warewulfd/util.go ++++ b/internal/pkg/warewulfd/util.go +@@ -63,7 +63,11 @@ func getOverlayFile( + } + + if build { +- err = overlay.BuildOverlay(n, context, stage_overlays) ++ if len(stage_overlays) > 0 { ++ err = overlay.BuildSpecificOverlays([]node.NodeInfo{n}, stage_overlays) ++ } else { ++ err = overlay.BuildAllOverlays([]node.NodeInfo{n}) ++ } + if err != nil { + wwlog.Error("Failed to build overlay: %s, %s, %s\n%s", + n.Id.Get(), stage_overlays, stage_file, err) diff --git a/verbose-exec.patch b/verbose-exec.patch new file mode 100644 index 0000000..84d4eeb --- /dev/null +++ b/verbose-exec.patch @@ -0,0 +1,26 @@ +diff --git a/internal/app/wwctl/container/exec/child/main.go b/internal/app/wwctl/container/exec/child/main.go +index a6502111..715e0db8 100644 +--- a/internal/app/wwctl/container/exec/child/main.go ++++ b/internal/app/wwctl/container/exec/child/main.go +@@ -21,6 +21,11 @@ import ( + "github.com/warewulf/warewulf/internal/pkg/wwlog" + ) + ++const exitEval = `$(VALU="$?" ; if [ $VALU == 0 ]; then echo write; else echo discard; fi)` ++const msgStr = `Changes are written back to container and image is rebuilt ++depending on exit status of last called program. ++Type "true" or "false" to enforce or abort image rebuilt.` ++ + func CobraRunE(cmd *cobra.Command, args []string) (err error) { + if os.Getpid() != 1 { + wwlog.Error("PID is not 1: %d", os.Getpid()) +@@ -79,7 +84,8 @@ func CobraRunE(cmd *cobra.Command, args []string) (err error) { + if err != nil { + return errors.Wrap(err, "failed to mount") + } +- ps1Str := fmt.Sprintf("[%s] Warewulf> ", containerName) ++ ps1Str := fmt.Sprintf("[%s|%s] Warewulf> ", exitEval, containerName) ++ wwlog.Info(msgStr) + if len(lowerObjects) != 0 && nodename == "" { + options := fmt.Sprintf("lowerdir=%s,upperdir=%s,workdir=%s", + path.Join(runDir, "lower"), containerPath, path.Join(runDir, "work")) diff --git a/warewulf4.changes b/warewulf4.changes index e1c7324..fb5faa2 100644 --- a/warewulf4.changes +++ b/warewulf4.changes @@ -7,6 +7,7 @@ Tue Jul 9 12:06:49 UTC 2024 - Christian Goll * don't want on NIS style passwd line (bsc#1227250) * wwctl impoer can have `passwd` and `user` argument (bsc#1227340) * add net.ifnames=1 to default kernel parameters (bsc#1226654) + * be more verbose if container is rebuild (bsc#1227646) - removed wwctl-configure-all-calls-SSH-keys.patch as included upstream - added following not yet accepted upstream patches: @@ -15,6 +16,7 @@ Tue Jul 9 12:06:49 UTC 2024 - Christian Goll * fix-overlay-built.patch * oci-vars.patch * issue-motd.patch + * verbose-exec.patch ------------------------------------------------------------------- Mon May 27 17:21:53 UTC 2024 - Christian Goll diff --git a/warewulf4.spec b/warewulf4.spec index 2cccd57..b3eef54 100644 --- a/warewulf4.spec +++ b/warewulf4.spec @@ -41,6 +41,7 @@ Patch2: enhanced-cont-list.patch Patch3: fix-overlay-built.patch Patch4: oci-vars.patch Patch5: issue-motd.patch +Patch6: verbose-exec.patch # no firewalld in sle12 %if 0%{?sle_version} >= 150000 || 0%{?suse_version} > 1500