diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2022-09-01 10:58:33 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-01 10:58:33 +0200 |
commit | 72f4c77139adf61bc39890e08ed9b86c365ae09b (patch) | |
tree | dcc20dee9e897343216322dc55a27f1ec88fd354 | |
parent | 009afb50b308548eb129bc68e654db6c6ad82e7a (diff) | |
parent | 368fa6074da72f4215b5fc5a5be974f17b45298d (diff) | |
download | podman-72f4c77139adf61bc39890e08ed9b86c365ae09b.tar.gz podman-72f4c77139adf61bc39890e08ed9b86c365ae09b.tar.bz2 podman-72f4c77139adf61bc39890e08ed9b86c365ae09b.zip |
Merge pull request #15360 from m0duspwnens/api_compat_containers
api: return imageID instead of imageName, for "Image" when Podman api is queried
-rw-r--r-- | pkg/api/handlers/compat/containers.go | 4 | ||||
-rw-r--r-- | test/apiv2/20-containers.at | 4 | ||||
-rw-r--r-- | test/apiv2/70-short-names.at | 2 |
3 files changed, 6 insertions, 4 deletions
diff --git a/pkg/api/handlers/compat/containers.go b/pkg/api/handlers/compat/containers.go index 0b82c48f6..61d6fc86d 100644 --- a/pkg/api/handlers/compat/containers.go +++ b/pkg/api/handlers/compat/containers.go @@ -407,7 +407,7 @@ func convertSecondaryIPPrefixLen(input *define.InspectNetworkSettings, output *t } func LibpodToContainerJSON(l *libpod.Container, sz bool) (*types.ContainerJSON, error) { - _, imageName := l.Image() + imageID, imageName := l.Image() inspect, err := l.Inspect(sz) if err != nil { return nil, err @@ -488,7 +488,7 @@ func LibpodToContainerJSON(l *libpod.Container, sz bool) (*types.ContainerJSON, Path: inspect.Path, Args: inspect.Args, State: &state, - Image: imageName, + Image: "sha256:" + imageID, ResolvConfPath: inspect.ResolvConfPath, HostnamePath: inspect.HostnamePath, HostsPath: inspect.HostsPath, diff --git a/test/apiv2/20-containers.at b/test/apiv2/20-containers.at index 655462f16..253bb2e45 100644 --- a/test/apiv2/20-containers.at +++ b/test/apiv2/20-containers.at @@ -309,7 +309,9 @@ t POST containers/create Image=${MultiTagName} 201 \ .Id~[0-9a-f]\\{64\\} cid=$(jq -r '.Id' <<<"$output") t GET containers/$cid/json 200 \ - .Image=${MultiTagName} + .Config.Image=${MultiTagName} \ + .Image~sha256:[0-9a-f]\\{64\\} + t DELETE containers/$cid 204 t DELETE images/${MultiTagName} 200 # vim: filetype=sh diff --git a/test/apiv2/70-short-names.at b/test/apiv2/70-short-names.at index 95cf0e1d0..952dd2ad1 100644 --- a/test/apiv2/70-short-names.at +++ b/test/apiv2/70-short-names.at @@ -9,7 +9,7 @@ t POST "images/create?fromImage=quay.io/libpod/alpine:latest" 200 .error~null .s # 14291 - let a short-name resolve to a *local* non Docker-Hub image. t POST containers/create Image=alpine 201 .Id~[0-9a-f]\\{64\\} cid=$(jq -r '.Id' <<<"$output") -t GET containers/$cid/json 200 .Image="quay.io/libpod/alpine:latest" +t GET containers/$cid/json 200 .Config.Image="quay.io/libpod/alpine:latest" .Image~sha256:[0-9a-f]\\{64\\} podman rm -f $cid ########## TAG |