diff options
author | Harald Albrecht <harald.albrecht@gmx.net> | 2022-09-06 18:38:28 +0200 |
---|---|---|
committer | Harald Albrecht <harald.albrecht@gmx.net> | 2022-09-06 20:29:44 +0200 |
commit | d759576ab3387321984da582810f3476dfa4df36 (patch) | |
tree | 86a53073033d1c829b16fd6156c7aae3334e1f25 /libpod | |
parent | 6da1eaf287c13a67dde688663b4dc8ed0cd868ad (diff) | |
download | podman-d759576ab3387321984da582810f3476dfa4df36.tar.gz podman-d759576ab3387321984da582810f3476dfa4df36.tar.bz2 podman-d759576ab3387321984da582810f3476dfa4df36.zip |
emit container labels also for container exited and exec died events
- adds unit test for container labels on container die event
- implements #15617
Signed-off-by: Harald Albrecht <harald.albrecht@gmx.net>
Diffstat (limited to 'libpod')
-rw-r--r-- | libpod/events.go | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/libpod/events.go b/libpod/events.go index c9e4c9d26..60142cb60 100644 --- a/libpod/events.go +++ b/libpod/events.go @@ -55,6 +55,12 @@ func (c *Container) newContainerExitedEvent(exitCode int32) { e.Image = c.config.RootfsImageName e.Type = events.Container e.ContainerExitCode = int(exitCode) + + e.Details = events.Details{ + ID: e.ID, + Attributes: c.Labels(), + } + if err := c.runtime.eventer.Write(e); err != nil { logrus.Errorf("Unable to write container exited event: %q", err) } @@ -70,6 +76,12 @@ func (c *Container) newExecDiedEvent(sessionID string, exitCode int) { e.ContainerExitCode = exitCode e.Attributes = make(map[string]string) e.Attributes["execID"] = sessionID + + e.Details = events.Details{ + ID: e.ID, + Attributes: c.Labels(), + } + if err := c.runtime.eventer.Write(e); err != nil { logrus.Errorf("Unable to write exec died event: %q", err) } |