aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2019-08-13 03:33:06 +0200
committerGitHub <noreply@github.com>2019-08-13 03:33:06 +0200
commitc48243ee1eb3fe36b54057994d5e908d8a3d7f16 (patch)
tree08258bc563fc91c3f5188ec144c94434ea0d256c
parentf634fd39001ad3dc62b83e5d78c6912db915a1e9 (diff)
parent62e8c328d85c7bfa2dc217034dbcf56d01b5d516 (diff)
downloadpodman-c48243ee1eb3fe36b54057994d5e908d8a3d7f16.tar.gz
podman-c48243ee1eb3fe36b54057994d5e908d8a3d7f16.tar.bz2
podman-c48243ee1eb3fe36b54057994d5e908d8a3d7f16.zip
Merge pull request #3797 from mheon/test_events_revert
Revert #3745 and fix missing exit code for journald
-rw-r--r--libpod/events/journal_linux.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/libpod/events/journal_linux.go b/libpod/events/journal_linux.go
index 7d195dc79..3bc3f6de7 100644
--- a/libpod/events/journal_linux.go
+++ b/libpod/events/journal_linux.go
@@ -4,6 +4,7 @@ package events
import (
"fmt"
+ "strconv"
"time"
"github.com/coreos/go-systemd/journal"
@@ -42,6 +43,9 @@ func (e EventJournalD) Write(ee Event) error {
m["PODMAN_IMAGE"] = ee.Image
m["PODMAN_NAME"] = ee.Name
m["PODMAN_ID"] = ee.ID
+ if ee.ContainerExitCode != 0 {
+ m["PODMAN_EXIT_CODE"] = strconv.Itoa(ee.ContainerExitCode)
+ }
case Volume:
m["PODMAN_NAME"] = ee.Name
}
@@ -150,6 +154,14 @@ func newEventFromJournalEntry(entry *sdjournal.JournalEntry) (*Event, error) { /
case Container, Pod:
newEvent.ID = entry.Fields["PODMAN_ID"]
newEvent.Image = entry.Fields["PODMAN_IMAGE"]
+ if code, ok := entry.Fields["PODMAN_EXIT_CODE"]; ok {
+ intCode, err := strconv.Atoi(code)
+ if err != nil {
+ logrus.Errorf("Error parsing event exit code %s", code)
+ } else {
+ newEvent.ContainerExitCode = intCode
+ }
+ }
case Image:
newEvent.ID = entry.Fields["PODMAN_ID"]
}