summaryrefslogtreecommitdiff
path: root/libpod/events/events.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2022-09-23 20:39:56 +0200
committerGitHub <noreply@github.com>2022-09-23 20:39:56 +0200
commitf658bbd230ed9cf6fbdabf5ddab5cfcf8f224636 (patch)
treefe84092f24438dd3a5d713f4439c1919552aaf5c /libpod/events/events.go
parent25dc2759e10bf0293f14a2205291ab7dd53eccf4 (diff)
parent6ee582315bfba8db13541406f6def26ecd8f6aeb (diff)
downloadpodman-f658bbd230ed9cf6fbdabf5ddab5cfcf8f224636.tar.gz
podman-f658bbd230ed9cf6fbdabf5ddab5cfcf8f224636.tar.bz2
podman-f658bbd230ed9cf6fbdabf5ddab5cfcf8f224636.zip
Merge pull request #15463 from mheon/fix_15408
Events for containers in pods now include the pod's ID
Diffstat (limited to 'libpod/events/events.go')
-rw-r--r--libpod/events/events.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/libpod/events/events.go b/libpod/events/events.go
index 764481e51..2105a3b89 100644
--- a/libpod/events/events.go
+++ b/libpod/events/events.go
@@ -76,7 +76,13 @@ func (e *Event) ToHumanReadable(truncate bool) string {
}
switch e.Type {
case Container, Pod:
- humanFormat = fmt.Sprintf("%s %s %s %s (image=%s, name=%s, health_status=%s", e.Time, e.Type, e.Status, id, e.Image, e.Name, e.HealthStatus)
+ humanFormat = fmt.Sprintf("%s %s %s %s (image=%s, name=%s", e.Time, e.Type, e.Status, id, e.Image, e.Name)
+ if e.PodID != "" {
+ humanFormat += fmt.Sprintf(", pod_id=%s", e.PodID)
+ }
+ if e.HealthStatus != "" {
+ humanFormat += fmt.Sprintf(", health_status=%s", e.HealthStatus)
+ }
// check if the container has labels and add it to the output
if len(e.Attributes) > 0 {
for k, v := range e.Attributes {