mirror of
https://github.com/containers/podman.git
synced 2025-05-17 15:18:43 +08:00
Add event on container death
Signed-off-by: Matthew Heon <matthew.heon@pm.me>
This commit is contained in:
@ -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)
|
||||
|
Reference in New Issue
Block a user