Skip to content

Commit

Permalink
events: support "die" filter
Browse files Browse the repository at this point in the history
Map "die" to the "died" status for Docker compat.

Fixes: containers#16857
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
  • Loading branch information
vrothberg committed Dec 21, 2022
1 parent 90ba443 commit a715068
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
3 changes: 3 additions & 0 deletions libpod/events/filters.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ func generateEventFilter(filter, filterValue string) (func(e *Event) bool, error
return strings.HasPrefix(e.ID, filterValue)
}, nil
case "EVENT", "STATUS":
if filterValue == "die" { // Docker compat
filterValue = "died"
}
return func(e *Event) bool {
return string(e.Status) == filterValue
}, nil
Expand Down
12 changes: 12 additions & 0 deletions test/system/090-events.bats
Original file line number Diff line number Diff line change
Expand Up @@ -291,3 +291,15 @@ EOF
_events_container_create_inspect_data journald
_events_container_create_inspect_data file
}

@test "events - docker compat" {
local cname=c$(random_string 15)
t0=$(date --iso-8601=seconds)
run_podman run --name=$cname --rm $IMAGE true
run_podman events \
--since="$t0" \
--filter=status=$cname \
--filter=status=die \
--stream=false
is "${lines[0]}" ".* container died .* (image=$IMAGE, name=$cname, .*)"
}

0 comments on commit a715068

Please sign in to comment.