remote API: restore v4 payload in container inspect

The v5 API made a breaking change for podman inspect, this means that
an old client could not longer parse the result from the new 5.X server.
The other way around new client and old server already worked.

As it turned out there were several users that run into this, one case
to hit this is using an old 4.X podman machine wich now pulls a newer
coreos with podman 5.0. But there are also other users running into it.
In order to keep the API working we now have a version check and return
the old v4 compatible payload so the old remote client can still work
against a newer server thus removing any major breaking change for an
old client.

Fixes #22657

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This commit is contained in:
Paul Holzinger
2024-05-14 17:42:47 +02:00
parent ef6619019f
commit bcb7edfded
4 changed files with 42 additions and 3 deletions

View File

@ -144,6 +144,11 @@ func GetContainer(w http.ResponseWriter, r *http.Request) {
utils.InternalServerError(w, err)
return
}
// if client request old v4 payload we should return v4 compatible json
if _, err := utils.SupportedVersion(r, ">=5.0.0"); err != nil {
data.Config.V4PodmanCompatMarshal = true
}
utils.WriteResponse(w, http.StatusOK, data)
}