diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2020-11-18 18:55:05 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-18 18:55:05 +0100 |
commit | 61a82159dbb154b2044595b156dbdb9fac04bedd (patch) | |
tree | 55a9809a4eb587344f80e702eab7b4b5609995ac /pkg/api/handlers/compat | |
parent | dcd498a6885f0293934214af0c6fc2d3c7717bd5 (diff) | |
parent | 4f427a89cbc0814c25dd4b562ddf4ff4e568a005 (diff) | |
download | podman-61a82159dbb154b2044595b156dbdb9fac04bedd.tar.gz podman-61a82159dbb154b2044595b156dbdb9fac04bedd.tar.bz2 podman-61a82159dbb154b2044595b156dbdb9fac04bedd.zip |
Merge pull request #8376 from Luap99/podman-filters
Align the podman ps --filter behavior with docker
Diffstat (limited to 'pkg/api/handlers/compat')
-rw-r--r-- | pkg/api/handlers/compat/containers_prune.go | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/pkg/api/handlers/compat/containers_prune.go b/pkg/api/handlers/compat/containers_prune.go index 397feac9a..2cfeebcce 100644 --- a/pkg/api/handlers/compat/containers_prune.go +++ b/pkg/api/handlers/compat/containers_prune.go @@ -16,7 +16,6 @@ func PruneContainers(w http.ResponseWriter, r *http.Request) { var ( delContainers []string space int64 - filterFuncs []libpod.ContainerFilter ) runtime := r.Context().Value("runtime").(*libpod.Runtime) decoder := r.Context().Value("decoder").(*schema.Decoder) @@ -28,15 +27,14 @@ func PruneContainers(w http.ResponseWriter, r *http.Request) { utils.Error(w, "Something went wrong.", http.StatusBadRequest, errors.Wrapf(err, "failed to parse parameters for %s", r.URL.String())) return } + filterFuncs := make([]libpod.ContainerFilter, 0, len(query.Filters)) for k, v := range query.Filters { - for _, val := range v { - generatedFunc, err := lpfilters.GenerateContainerFilterFuncs(k, val, runtime) - if err != nil { - utils.InternalServerError(w, err) - return - } - filterFuncs = append(filterFuncs, generatedFunc) + generatedFunc, err := lpfilters.GenerateContainerFilterFuncs(k, v, runtime) + if err != nil { + utils.InternalServerError(w, err) + return } + filterFuncs = append(filterFuncs, generatedFunc) } // Libpod response differs |