summaryrefslogtreecommitdiff
path: root/pkg/api/handlers
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-05-21 17:13:36 +0200
committerGitHub <noreply@github.com>2020-05-21 17:13:36 +0200
commit363f8820bc6d9ee19d2c95cfcbb05e93938cd53c (patch)
tree039de0bf1249b2762fa385ee8397ce569c83b9c0 /pkg/api/handlers
parent58baeab3303f0a666bca1f3dce706908f60626e1 (diff)
parent9add1abd12bbadef3dac778a72072fae3cb9c08b (diff)
downloadpodman-363f8820bc6d9ee19d2c95cfcbb05e93938cd53c.tar.gz
podman-363f8820bc6d9ee19d2c95cfcbb05e93938cd53c.tar.bz2
podman-363f8820bc6d9ee19d2c95cfcbb05e93938cd53c.zip
Merge pull request #6312 from rhatdan/image
Fix remote handling of podman images calls
Diffstat (limited to 'pkg/api/handlers')
-rw-r--r--pkg/api/handlers/utils/images.go33
1 files changed, 29 insertions, 4 deletions
diff --git a/pkg/api/handlers/utils/images.go b/pkg/api/handlers/utils/images.go
index 1c67de9db..7fb31a177 100644
--- a/pkg/api/handlers/utils/images.go
+++ b/pkg/api/handlers/utils/images.go
@@ -62,7 +62,6 @@ func GetImages(w http.ResponseWriter, r *http.Request) ([]*image.Image, error) {
}{
// This is where you can override the golang default value for one of fields
}
- // TODO I think all is implemented with a filter?
if err := decoder.Decode(&query, r.URL.Query()); err != nil {
return nil, err
@@ -71,6 +70,10 @@ func GetImages(w http.ResponseWriter, r *http.Request) ([]*image.Image, error) {
if _, found := r.URL.Query()["digests"]; found && query.Digests {
UnSupportedParameter("digests")
}
+ var (
+ images []*image.Image
+ err error
+ )
if len(query.Filters) > 0 {
for k, v := range query.Filters {
@@ -78,11 +81,33 @@ func GetImages(w http.ResponseWriter, r *http.Request) ([]*image.Image, error) {
filters = append(filters, fmt.Sprintf("%s=%s", k, val))
}
}
- return runtime.ImageRuntime().GetImagesWithFilters(filters)
+ images, err = runtime.ImageRuntime().GetImagesWithFilters(filters)
+ if err != nil {
+ return images, err
+ }
} else {
- return runtime.ImageRuntime().GetImages()
+ images, err = runtime.ImageRuntime().GetImages()
+ if err != nil {
+ return images, err
+ }
}
-
+ if query.All {
+ return images, nil
+ }
+ var returnImages []*image.Image
+ for _, img := range images {
+ if len(img.Names()) == 0 {
+ parent, err := img.IsParent(r.Context())
+ if err != nil {
+ return nil, err
+ }
+ if parent {
+ continue
+ }
+ }
+ returnImages = append(returnImages, img)
+ }
+ return returnImages, nil
}
func GetImage(r *http.Request, name string) (*image.Image, error) {