diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2021-03-27 12:36:47 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-27 12:36:47 +0000 |
commit | ec47312eebf11abcf74b5bf06df19ee2fb7b8afd (patch) | |
tree | 45b510ce0529d022fad75736b9ef83ae63a902fd /pkg/api/handlers/libpod/pods.go | |
parent | 5afcaeeaef8c4e45712ca957e0c224bc997b3797 (diff) | |
parent | 85015a5e23fe4944bdd2931311c0e6e223466f57 (diff) | |
download | podman-ec47312eebf11abcf74b5bf06df19ee2fb7b8afd.tar.gz podman-ec47312eebf11abcf74b5bf06df19ee2fb7b8afd.tar.bz2 podman-ec47312eebf11abcf74b5bf06df19ee2fb7b8afd.zip |
Merge pull request #9822 from jmguzik/fix-pods-list-filters-http-api
Fix list pods filter handling in libpod api
Diffstat (limited to 'pkg/api/handlers/libpod/pods.go')
-rw-r--r-- | pkg/api/handlers/libpod/pods.go | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/pkg/api/handlers/libpod/pods.go b/pkg/api/handlers/libpod/pods.go index 89a4a451f..4dc8740e2 100644 --- a/pkg/api/handlers/libpod/pods.go +++ b/pkg/api/handlers/libpod/pods.go @@ -44,13 +44,9 @@ func PodCreate(w http.ResponseWriter, r *http.Request) { func Pods(w http.ResponseWriter, r *http.Request) { runtime := r.Context().Value("runtime").(*libpod.Runtime) - decoder := r.Context().Value("decoder").(*schema.Decoder) - query := struct { - Filters map[string][]string `schema:"filters"` - }{ - // override any golang type defaults - } - if err := decoder.Decode(&query, r.URL.Query()); err != nil { + + filterMap, err := util.PrepareFilters(r) + if err != nil { utils.Error(w, http.StatusText(http.StatusBadRequest), http.StatusBadRequest, errors.Wrapf(err, "failed to parse parameters for %s", r.URL.String())) return @@ -58,7 +54,7 @@ func Pods(w http.ResponseWriter, r *http.Request) { containerEngine := abi.ContainerEngine{Libpod: runtime} podPSOptions := entities.PodPSOptions{ - Filters: query.Filters, + Filters: *filterMap, } pods, err := containerEngine.PodPs(r.Context(), podPSOptions) if err != nil { |