summaryrefslogtreecommitdiff
path: root/pkg/api/handlers/compat/containers_prune.go
diff options
context:
space:
mode:
authorPaul Holzinger <paul.holzinger@web.de>2020-11-17 16:43:17 +0100
committerPaul Holzinger <paul.holzinger@web.de>2020-11-18 11:36:06 +0100
commit4f427a89cbc0814c25dd4b562ddf4ff4e568a005 (patch)
tree0a0b18c76a96649e0a3482efe2c2b76514dd1a23 /pkg/api/handlers/compat/containers_prune.go
parent3502860e1cfe1042aca7a8de8446360662a5a2fd (diff)
downloadpodman-4f427a89cbc0814c25dd4b562ddf4ff4e568a005.tar.gz
podman-4f427a89cbc0814c25dd4b562ddf4ff4e568a005.tar.bz2
podman-4f427a89cbc0814c25dd4b562ddf4ff4e568a005.zip
Align the podman ps --filter behavior with docker
All of our filters worked exclusive resulting in `--filter status=created --filter status=exited` to return nothing. In docker filters with the same key work inclusive with the only exception being `label` which is exclusive. Filters with different keys always work exclusive. This PR aims to match the docker behavior with podman. Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
Diffstat (limited to 'pkg/api/handlers/compat/containers_prune.go')
-rw-r--r--pkg/api/handlers/compat/containers_prune.go14
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