Merge pull request #20062 from vrothberg/syslog-fix

pass --syslog to the cleanup process
This commit is contained in:
OpenShift Merge Robot
2023-09-20 11:57:33 -04:00
committed by GitHub
7 changed files with 25 additions and 9 deletions

View File

@@ -76,7 +76,6 @@ var (
dockerConfig = ""
debug bool
useSyslog bool
requireCleanup = true
// Defaults for capturing/redirecting the command output since (the) cobra is
@@ -611,7 +610,7 @@ func rootFlags(cmd *cobra.Command, podmanConfig *entities.PodmanConfig) {
pFlags.StringArrayVar(&podmanConfig.RuntimeFlags, runtimeflagFlagName, []string{}, "add global flags for the container runtime")
_ = rootCmd.RegisterFlagCompletionFunc(runtimeflagFlagName, completion.AutocompleteNone)
pFlags.BoolVar(&useSyslog, "syslog", false, "Output logging information to syslog as well as the console (default false)")
pFlags.BoolVar(&podmanConfig.Syslog, "syslog", false, "Output logging information to syslog as well as the console (default false)")
}
}

View File

@@ -6,12 +6,13 @@ package main
import (
"log/syslog"
"github.com/containers/podman/v4/cmd/podman/registry"
"github.com/sirupsen/logrus"
logrusSyslog "github.com/sirupsen/logrus/hooks/syslog"
)
func syslogHook() {
if !useSyslog {
if !registry.PodmanConfig().Syslog {
return
}

View File

@@ -6,13 +6,16 @@ package main
import (
"fmt"
"os"
"runtime"
"github.com/containers/podman/v4/cmd/podman/registry"
)
func syslogHook() {
if !useSyslog {
if !registry.PodmanConfig().Syslog {
return
}
fmt.Fprintf(os.Stderr, "Logging to Syslog is not supported on Windows")
fmt.Fprintf(os.Stderr, "Logging to Syslog is not supported on %s", runtime.GOOS)
os.Exit(1)
}