aboutsummaryrefslogtreecommitdiff
path: root/pkg/domain/entities/events.go
diff options
context:
space:
mode:
authorMatthew Heon <matthew.heon@pm.me>2022-08-24 13:27:17 -0400
committerMatthew Heon <matthew.heon@pm.me>2022-09-22 14:18:56 -0400
commit6ee582315bfba8db13541406f6def26ecd8f6aeb (patch)
treebc958f363aa5d40069baf9fb9933d189ba0e7a4a /pkg/domain/entities/events.go
parent08993516a939576fa009db6e7ed32524026a822d (diff)
downloadpodman-6ee582315bfba8db13541406f6def26ecd8f6aeb.tar.gz
podman-6ee582315bfba8db13541406f6def26ecd8f6aeb.tar.bz2
podman-6ee582315bfba8db13541406f6def26ecd8f6aeb.zip
Events for containers in pods now include the pod's ID
This allows tools like Cockpit to know that the pod in question has also been updated, so they can refresh the list of containers in the pod. Fixes #15408 Signed-off-by: Matthew Heon <matthew.heon@pm.me>
Diffstat (limited to 'pkg/domain/entities/events.go')
-rw-r--r--pkg/domain/entities/events.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/pkg/domain/entities/events.go b/pkg/domain/entities/events.go
index de218b285..34a6fe048 100644
--- a/pkg/domain/entities/events.go
+++ b/pkg/domain/entities/events.go
@@ -14,7 +14,7 @@ type Event struct {
// TODO: it would be nice to have full control over the types at some
// point and fork such Docker types.
dockerEvents.Message
- HealthStatus string
+ HealthStatus string `json:",omitempty"`
}
// ConvertToLibpodEvent converts an entities event to a libpod one.
@@ -34,6 +34,7 @@ func ConvertToLibpodEvent(e Event) *libpodEvents.Event {
image := e.Actor.Attributes["image"]
name := e.Actor.Attributes["name"]
details := e.Actor.Attributes
+ podID := e.Actor.Attributes["podId"]
delete(details, "image")
delete(details, "name")
delete(details, "containerExitCode")
@@ -47,6 +48,7 @@ func ConvertToLibpodEvent(e Event) *libpodEvents.Event {
Type: t,
HealthStatus: e.HealthStatus,
Details: libpodEvents.Details{
+ PodID: podID,
Attributes: details,
},
}
@@ -61,6 +63,7 @@ func ConvertToEntitiesEvent(e libpodEvents.Event) *Event {
attributes["image"] = e.Image
attributes["name"] = e.Name
attributes["containerExitCode"] = strconv.Itoa(e.ContainerExitCode)
+ attributes["podId"] = e.PodID
message := dockerEvents.Message{
// Compatibility with clients that still look for deprecated API elements
Status: e.Status.String(),