summaryrefslogtreecommitdiff
path: root/pkg
diff options
context:
space:
mode:
authorValentin Rothberg <rothberg@redhat.com>2021-06-04 13:15:33 +0200
committerMatthew Heon <mheon@redhat.com>2021-06-11 13:06:07 -0400
commitc751544facb3fb891f40d4d125940a51c0477494 (patch)
tree1c55d9186e501c696c484e0767d62d0712eaf33a /pkg
parentc28f442b28cf858feb0e7d9d6ee77df708030cd5 (diff)
downloadpodman-c751544facb3fb891f40d4d125940a51c0477494.tar.gz
podman-c751544facb3fb891f40d4d125940a51c0477494.tar.bz2
podman-c751544facb3fb891f40d4d125940a51c0477494.zip
remote events: support labels
Certain event meta data was lost when converting the remote events to libpod events and vice versa. Enable the skipped system tests for remote. Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
Diffstat (limited to 'pkg')
-rw-r--r--pkg/domain/entities/events.go28
1 files changed, 20 insertions, 8 deletions
diff --git a/pkg/domain/entities/events.go b/pkg/domain/entities/events.go
index 930ca53ae..5e7cc9ad1 100644
--- a/pkg/domain/entities/events.go
+++ b/pkg/domain/entities/events.go
@@ -30,29 +30,41 @@ func ConvertToLibpodEvent(e Event) *libpodEvents.Event {
if err != nil {
return nil
}
+ image := e.Actor.Attributes["image"]
+ name := e.Actor.Attributes["name"]
+ details := e.Actor.Attributes
+ delete(details, "image")
+ delete(details, "name")
+ delete(details, "containerExitCode")
return &libpodEvents.Event{
ContainerExitCode: exitCode,
ID: e.Actor.ID,
- Image: e.Actor.Attributes["image"],
- Name: e.Actor.Attributes["name"],
+ Image: image,
+ Name: name,
Status: status,
Time: time.Unix(e.Time, e.TimeNano),
Type: t,
+ Details: libpodEvents.Details{
+ Attributes: details,
+ },
}
}
// ConvertToEntitiesEvent converts a libpod event to an entities one.
func ConvertToEntitiesEvent(e libpodEvents.Event) *Event {
+ attributes := e.Details.Attributes
+ if attributes == nil {
+ attributes = make(map[string]string)
+ }
+ attributes["image"] = e.Image
+ attributes["name"] = e.Name
+ attributes["containerExitCode"] = strconv.Itoa(e.ContainerExitCode)
return &Event{dockerEvents.Message{
Type: e.Type.String(),
Action: e.Status.String(),
Actor: dockerEvents.Actor{
- ID: e.ID,
- Attributes: map[string]string{
- "image": e.Image,
- "name": e.Name,
- "containerExitCode": strconv.Itoa(e.ContainerExitCode),
- },
+ ID: e.ID,
+ Attributes: attributes,
},
Scope: "local",
Time: e.Time.Unix(),