From 063f332416c16532ada2465c3be53f1d4d8c8966 Mon Sep 17 00:00:00 2001 From: Matthew Heon Date: Thu, 25 Aug 2022 14:10:49 -0400 Subject: [PATCH] Compat API image remove events now have 'delete' status Change only the compat API, so we don't force a breaking change on Libpod API users. Partial fix for #15485 Signed-off-by: Matthew Heon --- pkg/api/handlers/compat/events.go | 6 ++++++ test/apiv2/10-images.at | 19 +++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/pkg/api/handlers/compat/events.go b/pkg/api/handlers/compat/events.go index 18fb35966b..105404a0d0 100644 --- a/pkg/api/handlers/compat/events.go +++ b/pkg/api/handlers/compat/events.go @@ -89,6 +89,12 @@ func GetEvents(w http.ResponseWriter, r *http.Request) { } e := entities.ConvertToEntitiesEvent(*evt) + // Some events differ between Libpod and Docker endpoints. + // Handle these differences for Docker-compat. + if !utils.IsLibpodRequest(r) && e.Type == "image" && e.Status == "remove" { + e.Status = "delete" + e.Action = "delete" + } if !utils.IsLibpodRequest(r) && e.Status == "died" { e.Status = "die" e.Action = "die" diff --git a/test/apiv2/10-images.at b/test/apiv2/10-images.at index 4fd954e37f..86ee2a1f50 100644 --- a/test/apiv2/10-images.at +++ b/test/apiv2/10-images.at @@ -239,4 +239,23 @@ fi cleanBuildTest +# compat API vs libpod API event differences: +# on image removal, libpod produces 'remove' events. +# compat produces 'delete' events. +podman image build -t test:test -<