diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2020-10-01 13:32:02 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-01 13:32:02 -0400 |
commit | 5d22eb02f95f28a87ed263afe28b7ff4bf2f6fee (patch) | |
tree | 818213afcae3939d007ca76c744ea2c12f2786e1 /pkg/api | |
parent | 11dfe9385c0115a9269c269f76ef9b0ae0dc26ac (diff) | |
parent | 7ac8000cc1925c3c46a3afcd4ff23b1d09bddfe3 (diff) | |
download | podman-5d22eb02f95f28a87ed263afe28b7ff4bf2f6fee.tar.gz podman-5d22eb02f95f28a87ed263afe28b7ff4bf2f6fee.tar.bz2 podman-5d22eb02f95f28a87ed263afe28b7ff4bf2f6fee.zip |
Merge pull request #7735 from QiWang19/manifest-inspect
fix allowing inspect manifest of non-local image
Diffstat (limited to 'pkg/api')
-rw-r--r-- | pkg/api/handlers/libpod/manifests.go | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/pkg/api/handlers/libpod/manifests.go b/pkg/api/handlers/libpod/manifests.go index 8e65248e2..2031dd42f 100644 --- a/pkg/api/handlers/libpod/manifests.go +++ b/pkg/api/handlers/libpod/manifests.go @@ -6,11 +6,13 @@ import ( "github.com/containers/buildah/manifests" copy2 "github.com/containers/image/v5/copy" + "github.com/containers/image/v5/manifest" "github.com/containers/image/v5/transports/alltransports" "github.com/containers/podman/v2/libpod" "github.com/containers/podman/v2/libpod/image" "github.com/containers/podman/v2/pkg/api/handlers" "github.com/containers/podman/v2/pkg/api/handlers/utils" + "github.com/containers/podman/v2/pkg/domain/infra/abi" "github.com/gorilla/schema" "github.com/opencontainers/go-digest" "github.com/pkg/errors" @@ -48,17 +50,18 @@ func ManifestCreate(w http.ResponseWriter, r *http.Request) { func ManifestInspect(w http.ResponseWriter, r *http.Request) { runtime := r.Context().Value("runtime").(*libpod.Runtime) name := utils.GetName(r) - newImage, err := runtime.ImageRuntime().NewFromLocal(name) - if err != nil { - utils.ImageNotFound(w, name, err) + imageEngine := abi.ImageEngine{Libpod: runtime} + inspectReport, inspectError := imageEngine.ManifestInspect(r.Context(), name) + if inspectError != nil { + utils.Error(w, "Something went wrong.", http.StatusNotFound, inspectError) return } - data, err := newImage.InspectManifest() - if err != nil { - utils.InternalServerError(w, err) + var list manifest.Schema2List + if err := json.Unmarshal(inspectReport, &list); err != nil { + utils.Error(w, "Something went wrong.", http.StatusInternalServerError, errors.Wrap(err, "Unmarshal()")) return } - utils.WriteResponse(w, http.StatusOK, data) + utils.WriteResponse(w, http.StatusOK, &list) } func ManifestAdd(w http.ResponseWriter, r *http.Request) { |