summaryrefslogtreecommitdiff
path: root/pkg
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-02-14 00:32:33 +0100
committerGitHub <noreply@github.com>2020-02-14 00:32:33 +0100
commit0c060dace19710716ff8f3a65865a295312d9d94 (patch)
tree2e9b72b242e761f7191a0c55cffc9bec96d6aa53 /pkg
parent1b290f995b0dec0d9ac58ddba93f8b6b24dc6d0a (diff)
parentce7c9c998c0be927356eb65471c2499196e666aa (diff)
downloadpodman-0c060dace19710716ff8f3a65865a295312d9d94.tar.gz
podman-0c060dace19710716ff8f3a65865a295312d9d94.tar.bz2
podman-0c060dace19710716ff8f3a65865a295312d9d94.zip
Merge pull request #5190 from baude/apiv2cockpit3
filtering behavior correction
Diffstat (limited to 'pkg')
-rw-r--r--pkg/api/handlers/libpod/containers.go10
1 files changed, 8 insertions, 2 deletions
diff --git a/pkg/api/handlers/libpod/containers.go b/pkg/api/handlers/libpod/containers.go
index e11e26510..ce2836a72 100644
--- a/pkg/api/handlers/libpod/containers.go
+++ b/pkg/api/handlers/libpod/containers.go
@@ -83,6 +83,8 @@ func ListContainers(w http.ResponseWriter, r *http.Request) {
Pod: query.Pod,
Sync: query.Sync,
}
+
+ all := query.All
if len(query.Filters) > 0 {
for k, v := range query.Filters {
for _, val := range v {
@@ -96,8 +98,12 @@ func ListContainers(w http.ResponseWriter, r *http.Request) {
}
}
- if !query.All {
- // The default is get only running containers. Do this with a filterfunc
+ // Docker thinks that if status is given as an input, then we should override
+ // the all setting and always deal with all containers.
+ if len(query.Filters["status"]) > 0 {
+ all = true
+ }
+ if !all {
runningOnly, err := shared.GenerateContainerFilterFuncs("status", define.ContainerStateRunning.String(), runtime)
if err != nil {
utils.InternalServerError(w, err)