mirror of https://github.com/containers/podman.git
events: support "die" filter
Map "die" to the "died" status for Docker compat. Fixes: #16857 Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
This commit is contained in:
parent
5211446516
commit
45b180c1f8
|
@ -26,6 +26,7 @@ The *container* event type will report the follow statuses:
|
||||||
* commit
|
* commit
|
||||||
* connect
|
* connect
|
||||||
* create
|
* create
|
||||||
|
* died
|
||||||
* disconnect
|
* disconnect
|
||||||
* exec
|
* exec
|
||||||
* exec_died
|
* exec_died
|
||||||
|
@ -91,7 +92,7 @@ filters are supported:
|
||||||
* volume=name_or_id
|
* volume=name_or_id
|
||||||
* type=event_type (described above)
|
* type=event_type (described above)
|
||||||
|
|
||||||
In the case where an ID is used, the ID may be in its full or shortened form.
|
In the case where an ID is used, the ID may be in its full or shortened form. The "die" event is mapped to "died" for Docker compatibility.
|
||||||
|
|
||||||
#### **--format**
|
#### **--format**
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,9 @@ func generateEventFilter(filter, filterValue string) (func(e *Event) bool, error
|
||||||
return strings.HasPrefix(e.ID, filterValue)
|
return strings.HasPrefix(e.ID, filterValue)
|
||||||
}, nil
|
}, nil
|
||||||
case "EVENT", "STATUS":
|
case "EVENT", "STATUS":
|
||||||
|
if filterValue == "die" { // Docker compat
|
||||||
|
filterValue = "died"
|
||||||
|
}
|
||||||
return func(e *Event) bool {
|
return func(e *Event) bool {
|
||||||
return string(e.Status) == filterValue
|
return string(e.Status) == filterValue
|
||||||
}, nil
|
}, nil
|
||||||
|
|
|
@ -291,3 +291,15 @@ EOF
|
||||||
_events_container_create_inspect_data journald
|
_events_container_create_inspect_data journald
|
||||||
_events_container_create_inspect_data file
|
_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, .*)"
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue