warewulf4/verbose-exec.patch
Christian Goll 70b45730b3 - Update to version 4.6.0rc3 what is a major upgrade with following
highlights:
  * renamed container to images
  * "sprig" functions in overlays
  * support for yaml and json formatted output
  * completely re-designed kernel selection support
  * nested profiles
  * arbitrary node and profile data in new "resources" structure
  * moved NFS mount options to resources / fstab overlay
  * split overlays by function
  * split overlays, site vs distribution
  * replaced defaults.conf with settings on default profile
  * improved tabular output
  * parallel overlay build
  * improved networking functionality (static route, vlans, and bonds)
  * kernel arguments as a list
  * non-zero exit codes on wwctl errors
  * fixed argument parsing for wwctl image exec
  * Defined menu for ipxe boot
  * Re-order SSH key types to make ed25519 default.
- The configuation files nodes.conf and warewulf.conf will be updated
  on upgrade and the unmodified configuration files will be saved 
  as nodes.conf.4.5.x and warewulf.conf.4.5.x

OBS-URL: https://build.opensuse.org/package/show/network:cluster/warewulf4?expand=0&rev=99
2025-02-25 18:44:20 +00:00

27 lines
1.2 KiB
Diff

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