diff options
author | Brent Baude <bbaude@redhat.com> | 2020-02-12 16:08:07 -0600 |
---|---|---|
committer | Brent Baude <bbaude@redhat.com> | 2020-02-12 16:08:07 -0600 |
commit | ce7c9c998c0be927356eb65471c2499196e666aa (patch) | |
tree | e73c2e3d3cde76ba9f4d8ce683243cdc072b014f /pkg/api/handlers/libpod/containers.go | |
parent | 2281cbdd6d5b1b7bca99a605ffc8625b6bee7eb3 (diff) | |
download | podman-ce7c9c998c0be927356eb65471c2499196e666aa.tar.gz podman-ce7c9c998c0be927356eb65471c2499196e666aa.tar.bz2 podman-ce7c9c998c0be927356eb65471c2499196e666aa.zip |
filtering behavior correction
when filtering containers, if a status= is provided as an input filter, then we should override the all to always be true.
Signed-off-by: Brent Baude <bbaude@redhat.com>
Diffstat (limited to 'pkg/api/handlers/libpod/containers.go')
-rw-r--r-- | pkg/api/handlers/libpod/containers.go | 10 |
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) |