summaryrefslogtreecommitdiff
path: root/libpod/events.go
diff options
context:
space:
mode:
authorMatthew Heon <matthew.heon@pm.me>2019-03-12 16:12:09 -0400
committerMatthew Heon <matthew.heon@pm.me>2019-03-13 10:18:51 -0400
commit3b5805d521b8fa8a948efe74133ad1148a4c180d (patch)
treec5bfc0a0e48019e4dacda504532e1c6e00b60711 /libpod/events.go
parent8b3f759800ebd6e53e0a807728ede633aa9bdb36 (diff)
downloadpodman-3b5805d521b8fa8a948efe74133ad1148a4c180d.tar.gz
podman-3b5805d521b8fa8a948efe74133ad1148a4c180d.tar.bz2
podman-3b5805d521b8fa8a948efe74133ad1148a4c180d.zip
Add event on container death
Signed-off-by: Matthew Heon <matthew.heon@pm.me>
Diffstat (limited to 'libpod/events.go')
-rw-r--r--libpod/events.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/libpod/events.go b/libpod/events.go
index 9806c117b..879aeb6c5 100644
--- a/libpod/events.go
+++ b/libpod/events.go
@@ -19,6 +19,19 @@ func (c *Container) newContainerEvent(status events.Status) {
}
}
+// newContainerExitedEvent creates a new event for a container's death
+func (c *Container) newContainerExitedEvent(exitCode int32) {
+ e := events.NewEvent(events.Exited)
+ e.ID = c.ID()
+ e.Name = c.Name()
+ e.Image = c.config.RootfsImageName
+ e.Type = events.Container
+ e.ContainerExitCode = int(exitCode)
+ if err := e.Write(c.runtime.config.EventsLogFilePath); err != nil {
+ logrus.Errorf("unable to write event to %s", c.runtime.config.EventsLogFilePath)
+ }
+}
+
// newPodEvent creates a new event for a libpod pod
func (p *Pod) newPodEvent(status events.Status) {
e := events.NewEvent(status)