diff options
author | Jhon Honce <jhonce@redhat.com> | 2020-03-26 17:16:59 -0700 |
---|---|---|
committer | Jhon Honce <jhonce@redhat.com> | 2020-03-26 18:32:44 -0700 |
commit | 581dd312af6ada92b96e16dd95d45967bde5fd8a (patch) | |
tree | 13e55270aa70201f5514b769410a736a07b102af /pkg/api/handlers/libpod | |
parent | 1710eca4e930f7ed3a2b060029c627c1a66a2349 (diff) | |
download | podman-581dd312af6ada92b96e16dd95d45967bde5fd8a.tar.gz podman-581dd312af6ada92b96e16dd95d45967bde5fd8a.tar.bz2 podman-581dd312af6ada92b96e16dd95d45967bde5fd8a.zip |
V2 podman image prune
* Fixed header for `podman image ls`
* Implemented prune `all` flag, preserved filter method for backwards
capability
* Updated binding tests
Signed-off-by: Jhon Honce <jhonce@redhat.com>
Diffstat (limited to 'pkg/api/handlers/libpod')
-rw-r--r-- | pkg/api/handlers/libpod/images.go | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/pkg/api/handlers/libpod/images.go b/pkg/api/handlers/libpod/images.go index f8e666451..ee85c1a41 100644 --- a/pkg/api/handlers/libpod/images.go +++ b/pkg/api/handlers/libpod/images.go @@ -119,12 +119,12 @@ func GetImages(w http.ResponseWriter, r *http.Request) { func PruneImages(w http.ResponseWriter, r *http.Request) { var ( - all bool err error ) runtime := r.Context().Value("runtime").(*libpod.Runtime) decoder := r.Context().Value("decoder").(*schema.Decoder) query := struct { + All bool `schema:"all"` Filters map[string][]string `schema:"filters"` }{ // override any golang type defaults @@ -140,7 +140,7 @@ func PruneImages(w http.ResponseWriter, r *http.Request) { if _, found := r.URL.Query()["filters"]; found { dangling := query.Filters["all"] if len(dangling) > 0 { - all, err = strconv.ParseBool(query.Filters["all"][0]) + query.All, err = strconv.ParseBool(query.Filters["all"][0]) if err != nil { utils.InternalServerError(w, err) return @@ -152,7 +152,8 @@ func PruneImages(w http.ResponseWriter, r *http.Request) { libpodFilters = append(libpodFilters, fmt.Sprintf("%s=%s", k, v[0])) } } - cids, err := runtime.ImageRuntime().PruneImages(r.Context(), all, libpodFilters) + + cids, err := runtime.ImageRuntime().PruneImages(r.Context(), query.All, libpodFilters) if err != nil { utils.Error(w, "Something went wrong.", http.StatusInternalServerError, err) return |