SHA256
1
0
forked from pool/warewulf4

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
This commit is contained in:
Christian Goll 2024-07-11 09:10:17 +00:00 committed by Git OBS Bridge
parent cb754ad51c
commit 2cb546538d
4 changed files with 46 additions and 17 deletions

View File

@ -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)

26
verbose-exec.patch Normal file
View File

@ -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"))

View File

@ -7,6 +7,7 @@ Tue Jul 9 12:06:49 UTC 2024 - Christian Goll <cgoll@suse.com>
* 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 <cgoll@suse.com>
* fix-overlay-built.patch
* oci-vars.patch
* issue-motd.patch
* verbose-exec.patch
-------------------------------------------------------------------
Mon May 27 17:21:53 UTC 2024 - Christian Goll <cgoll@suse.com>

View File

@ -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