pass log level to container exec

This commit is contained in:
Christian Goll
2023-01-16 15:50:25 +01:00
parent 88b740d74d
commit 55f61a7c18
2 changed files with 11 additions and 2 deletions

View File

@@ -17,9 +17,13 @@ import (
"github.com/spf13/cobra"
)
/*
fork off a process with a new PID space
*/
func runContainedCmd(args []string) error {
logStr := fmt.Sprint(wwlog.GetLogLevel())
wwlog.Verbose("Running contained command: %s", args[1:])
c := exec.Command("/proc/self/exe", append([]string{"container", "exec", "__child"}, args...)...)
c := exec.Command("/proc/self/exe", append([]string{"--loglevel", logStr, "container", "exec", "__child"}, args...)...)
c.SysProcAttr = &syscall.SysProcAttr{
Cloneflags: syscall.CLONE_NEWUTS | syscall.CLONE_NEWPID | syscall.CLONE_NEWNS,