diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2020-02-12 22:43:59 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-12 22:43:59 +0100 |
commit | 2281cbdd6d5b1b7bca99a605ffc8625b6bee7eb3 (patch) | |
tree | debc8c5cfa9a28393c0c13b4dd7e00f83f1fe5e1 /pkg/api | |
parent | e74ad3596393a476b7e233da736a610ef19bc4a1 (diff) | |
parent | ad4a92c5e53f222bd99d2b55e175eef48d077cf4 (diff) | |
download | podman-2281cbdd6d5b1b7bca99a605ffc8625b6bee7eb3.tar.gz podman-2281cbdd6d5b1b7bca99a605ffc8625b6bee7eb3.tar.bz2 podman-2281cbdd6d5b1b7bca99a605ffc8625b6bee7eb3.zip |
Merge pull request #5171 from baude/apiv2cockpit2
Fix container filters
Diffstat (limited to 'pkg/api')
-rw-r--r-- | pkg/api/handlers/libpod/containers.go | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/pkg/api/handlers/libpod/containers.go b/pkg/api/handlers/libpod/containers.go index a64ed446c..e11e26510 100644 --- a/pkg/api/handlers/libpod/containers.go +++ b/pkg/api/handlers/libpod/containers.go @@ -56,7 +56,7 @@ func ListContainers(w http.ResponseWriter, r *http.Request) { decoder := r.Context().Value("decoder").(*schema.Decoder) query := struct { All bool `schema:"all"` - Filter map[string][]string `schema:"filter"` + Filters map[string][]string `schema:"filters"` Last int `schema:"last"` Namespace bool `schema:"namespace"` Pod bool `schema:"pod"` @@ -71,6 +71,7 @@ func ListContainers(w http.ResponseWriter, r *http.Request) { errors.Wrapf(err, "Failed to parse parameters for %s", r.URL.String())) return } + runtime := r.Context().Value("runtime").(*libpod.Runtime) opts := shared.PsOptions{ All: query.All, @@ -82,8 +83,8 @@ func ListContainers(w http.ResponseWriter, r *http.Request) { Pod: query.Pod, Sync: query.Sync, } - if len(query.Filter) > 0 { - for k, v := range query.Filter { + if len(query.Filters) > 0 { + for k, v := range query.Filters { for _, val := range v { generatedFunc, err := shared.GenerateContainerFilterFuncs(k, val, runtime) if err != nil { |