summaryrefslogtreecommitdiff
path: root/pkg/api
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-05-13 13:38:47 -0700
committerGitHub <noreply@github.com>2020-05-13 13:38:47 -0700
commitfa5b33e70b96ea8dfca3b46cab44a2e07028bf0c (patch)
tree8f20bbbf676ca47d8bcb3cf40d4c9f6b8e6c0fde /pkg/api
parent5e245b02e9330dab6b161b88b8c13978c27ff5d9 (diff)
parent3fea2f0a91fb62848d481e027fde7109cdb0ebeb (diff)
downloadpodman-fa5b33e70b96ea8dfca3b46cab44a2e07028bf0c.tar.gz
podman-fa5b33e70b96ea8dfca3b46cab44a2e07028bf0c.tar.bz2
podman-fa5b33e70b96ea8dfca3b46cab44a2e07028bf0c.zip
Merge pull request #6211 from baude/v2remoteimagetree
enable remote image tree
Diffstat (limited to 'pkg/api')
-rw-r--r--pkg/api/handlers/libpod/images.go19
1 files changed, 8 insertions, 11 deletions
diff --git a/pkg/api/handlers/libpod/images.go b/pkg/api/handlers/libpod/images.go
index 93b4564a1..1cbcfb52c 100644
--- a/pkg/api/handlers/libpod/images.go
+++ b/pkg/api/handlers/libpod/images.go
@@ -56,13 +56,6 @@ func ImageExists(w http.ResponseWriter, r *http.Request) {
func ImageTree(w http.ResponseWriter, r *http.Request) {
runtime := r.Context().Value("runtime").(*libpod.Runtime)
name := utils.GetName(r)
-
- img, err := runtime.ImageRuntime().NewFromLocal(name)
- if err != nil {
- utils.Error(w, "Something went wrong.", http.StatusNotFound, errors.Wrapf(err, "Failed to find image %s", name))
- return
- }
-
decoder := r.Context().Value("decoder").(*schema.Decoder)
query := struct {
WhatRequires bool `schema:"whatrequires"`
@@ -74,14 +67,18 @@ func ImageTree(w http.ResponseWriter, r *http.Request) {
errors.Wrapf(err, "failed to parse parameters for %s", r.URL.String()))
return
}
-
- tree, err := img.GenerateTree(query.WhatRequires)
+ ir := abi.ImageEngine{Libpod: runtime}
+ options := entities.ImageTreeOptions{WhatRequires: query.WhatRequires}
+ report, err := ir.Tree(r.Context(), name, options)
if err != nil {
+ if errors.Cause(err) == define.ErrNoSuchImage {
+ utils.Error(w, "Something went wrong.", http.StatusNotFound, errors.Wrapf(err, "Failed to find image %s", name))
+ return
+ }
utils.Error(w, "Server error", http.StatusInternalServerError, errors.Wrapf(err, "failed to generate image tree for %s", name))
return
}
-
- utils.WriteResponse(w, http.StatusOK, tree)
+ utils.WriteResponse(w, http.StatusOK, report)
}
func GetImage(w http.ResponseWriter, r *http.Request) {