summaryrefslogtreecommitdiff
path: root/pkg/api/handlers/libpod/pods.go
diff options
context:
space:
mode:
authorJakub Guzik <jakubmguzik@gmail.com>2021-03-26 09:34:34 +0100
committerMatthew Heon <mheon@redhat.com>2021-03-29 11:31:49 -0400
commitd498022fdde96ef1eb028ea89bb68bf01ca495c5 (patch)
treeff0508fdc806dda6a75cdddd3335d89ed2c90ca7 /pkg/api/handlers/libpod/pods.go
parent66b1c2bd998e0b0118e56a4dea7880a4eeada998 (diff)
downloadpodman-d498022fdde96ef1eb028ea89bb68bf01ca495c5.tar.gz
podman-d498022fdde96ef1eb028ea89bb68bf01ca495c5.tar.bz2
podman-d498022fdde96ef1eb028ea89bb68bf01ca495c5.zip
Fix list pods filter handling in libpod api
Signed-off-by: Jakub Guzik <jakubmguzik@gmail.com>
Diffstat (limited to 'pkg/api/handlers/libpod/pods.go')
-rw-r--r--pkg/api/handlers/libpod/pods.go12
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 {