mirror of
https://github.com/containers/podman.git
synced 2025-08-06 11:32:07 +08:00
Merge pull request #5190 from baude/apiv2cockpit3
filtering behavior correction
This commit is contained in:
@ -83,6 +83,8 @@ func ListContainers(w http.ResponseWriter, r *http.Request) {
|
|||||||
Pod: query.Pod,
|
Pod: query.Pod,
|
||||||
Sync: query.Sync,
|
Sync: query.Sync,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
all := query.All
|
||||||
if len(query.Filters) > 0 {
|
if len(query.Filters) > 0 {
|
||||||
for k, v := range query.Filters {
|
for k, v := range query.Filters {
|
||||||
for _, val := range v {
|
for _, val := range v {
|
||||||
@ -96,8 +98,12 @@ func ListContainers(w http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if !query.All {
|
// Docker thinks that if status is given as an input, then we should override
|
||||||
// The default is get only running containers. Do this with a filterfunc
|
// 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)
|
runningOnly, err := shared.GenerateContainerFilterFuncs("status", define.ContainerStateRunning.String(), runtime)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
utils.InternalServerError(w, err)
|
utils.InternalServerError(w, err)
|
||||||
|
Reference in New Issue
Block a user