diff options
author | Paul Holzinger <paul.holzinger@web.de> | 2020-11-18 11:23:30 +0100 |
---|---|---|
committer | Paul Holzinger <paul.holzinger@web.de> | 2020-11-18 19:31:25 +0100 |
commit | e7fd9234cd0e6a23e32dd31c912ac47883b59738 (patch) | |
tree | 7befe4ca3c1e47c52aec7eaaec26204d729ae849 /pkg/domain | |
parent | 6ece1d97c428f1641cb35972357cd037562fd06e (diff) | |
download | podman-e7fd9234cd0e6a23e32dd31c912ac47883b59738.tar.gz podman-e7fd9234cd0e6a23e32dd31c912ac47883b59738.tar.bz2 podman-e7fd9234cd0e6a23e32dd31c912ac47883b59738.zip |
Align the podman pod ps --filter behavior with podman ps
Filters with the same key work inclusive with the only exception being
`label` which is exclusive. Filters with different keys always work exclusive.
Also update the documentation with the new behavior.
Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
Diffstat (limited to 'pkg/domain')
-rw-r--r-- | pkg/domain/infra/abi/pods.go | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/pkg/domain/infra/abi/pods.go b/pkg/domain/infra/abi/pods.go index 258640a81..11374e513 100644 --- a/pkg/domain/infra/abi/pods.go +++ b/pkg/domain/infra/abi/pods.go @@ -282,20 +282,17 @@ func (ic *ContainerEngine) PodTop(ctx context.Context, options entities.PodTopOp func (ic *ContainerEngine) PodPs(ctx context.Context, options entities.PodPSOptions) ([]*entities.ListPodsReport, error) { var ( - err error - filters = []libpod.PodFilter{} - pds = []*libpod.Pod{} + err error + pds = []*libpod.Pod{} ) + filters := make([]libpod.PodFilter, 0, len(options.Filters)) for k, v := range options.Filters { - for _, filter := range v { - f, err := lpfilters.GeneratePodFilterFunc(k, filter) - if err != nil { - return nil, err - } - filters = append(filters, f) - + f, err := lpfilters.GeneratePodFilterFunc(k, v) + if err != nil { + return nil, err } + filters = append(filters, f) } if options.Latest { pod, err := ic.Libpod.GetLatestPod() |