diff options
author | Daniel J Walsh <dwalsh@redhat.com> | 2022-01-12 15:46:53 -0500 |
---|---|---|
committer | Daniel J Walsh <dwalsh@redhat.com> | 2022-01-13 08:14:50 -0500 |
commit | fa6405c3c39c2f054d71323256c65bef34d7aed0 (patch) | |
tree | 28c0cb43aab46e780d843599460a00e9daa8d3af | |
parent | cb06133d42e4041fe19d2e66f254abf188f1025e (diff) | |
download | podman-fa6405c3c39c2f054d71323256c65bef34d7aed0.tar.gz podman-fa6405c3c39c2f054d71323256c65bef34d7aed0.tar.bz2 podman-fa6405c3c39c2f054d71323256c65bef34d7aed0.zip |
use events_logfile_path from containers.conf for events log.
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
-rw-r--r-- | libpod/options.go | 2 | ||||
-rw-r--r-- | libpod/runtime.go | 4 | ||||
-rw-r--r-- | test/system/090-events.bats | 13 |
3 files changed, 16 insertions, 3 deletions
diff --git a/libpod/options.go b/libpod/options.go index 44505da26..630fe809d 100644 --- a/libpod/options.go +++ b/libpod/options.go @@ -500,8 +500,6 @@ func WithEventsLogger(logger string) RuntimeOption { } rt.config.Engine.EventsLogger = logger - rt.config.Engine.EventsLogFilePath = filepath.Join(rt.config.Engine.TmpDir, "events", "events.log") - return nil } } diff --git a/libpod/runtime.go b/libpod/runtime.go index 3297b1ddd..90cd8ffe0 100644 --- a/libpod/runtime.go +++ b/libpod/runtime.go @@ -1114,7 +1114,9 @@ func (r *Runtime) mergeDBConfig(dbConfig *DBConfig) { logrus.Debugf("Overriding tmp dir %q with %q from database", c.TmpDir, dbConfig.LibpodTmp) } c.TmpDir = dbConfig.LibpodTmp - c.EventsLogFilePath = filepath.Join(dbConfig.LibpodTmp, "events", "events.log") + if c.EventsLogFilePath == "" { + c.EventsLogFilePath = filepath.Join(dbConfig.LibpodTmp, "events", "events.log") + } } if !r.storageSet.VolumePathSet && dbConfig.VolumePath != "" { diff --git a/test/system/090-events.bats b/test/system/090-events.bats index 5af6a3793..a0b0380a2 100644 --- a/test/system/090-events.bats +++ b/test/system/090-events.bats @@ -116,3 +116,16 @@ function _events_disjunctive_filters() { @test "events with disjunctive filters - default" { _events_disjunctive_filters "" } + +@test "events with events_logfile_path in containers.conf" { + skip_if_remote "remote does not support --events-backend" + events_file=$PODMAN_TMPDIR/events.log + containersconf=$PODMAN_TMPDIR/containers.conf + cat >$containersconf <<EOF +[engine] +events_logfile_path="$events_file" +EOF + CONTAINERS_CONF="$containersconf" run_podman --events-backend=file pull $IMAGE + run cat $events_file + is "$output" ".*\"Name\":\"$IMAGE" "test" +} |