diff options
author | Charlie Doern <cdoern@redhat.com> | 2022-07-11 13:51:45 -0400 |
---|---|---|
committer | Charlie Doern <cdoern@redhat.com> | 2022-07-25 09:28:26 -0400 |
commit | 4724a0000d48d372c84057a065e40a1bd298603a (patch) | |
tree | 5324e65ee23a9259c8d55d1c366904729856bc18 /pkg/domain/filters/containers.go | |
parent | da1f47921685f40f1b26405278cbf9cb2d06fe09 (diff) | |
download | podman-4724a0000d48d372c84057a065e40a1bd298603a.tar.gz podman-4724a0000d48d372c84057a065e40a1bd298603a.tar.bz2 podman-4724a0000d48d372c84057a065e40a1bd298603a.zip |
prune filter handling
network and container prune could not handle the label!=... filter. vendor in c/common to fix this and
add some podman level handling to make everything run smoothly
resolves #14182
Signed-off-by: Charlie Doern <cdoern@redhat.com>
Diffstat (limited to 'pkg/domain/filters/containers.go')
-rw-r--r-- | pkg/domain/filters/containers.go | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/pkg/domain/filters/containers.go b/pkg/domain/filters/containers.go index f88a165e7..de62b6582 100644 --- a/pkg/domain/filters/containers.go +++ b/pkg/domain/filters/containers.go @@ -7,6 +7,7 @@ import ( "strings" "time" + "github.com/containers/common/pkg/filters" cutil "github.com/containers/common/pkg/util" "github.com/containers/podman/v4/libpod" "github.com/containers/podman/v4/libpod/define" @@ -24,7 +25,7 @@ func GenerateContainerFilterFuncs(filter string, filterValues []string, r *libpo case "label": // we have to match that all given labels exits on that container return func(c *libpod.Container) bool { - return util.MatchLabelFilters(filterValues, c.Labels()) + return filters.MatchLabelFilters(filterValues, c.Labels()) }, nil case "name": // we only have to match one name @@ -299,7 +300,11 @@ func GeneratePruneContainerFilterFuncs(filter string, filterValues []string, r * switch filter { case "label": return func(c *libpod.Container) bool { - return util.MatchLabelFilters(filterValues, c.Labels()) + return filters.MatchLabelFilters(filterValues, c.Labels()) + }, nil + case "label!": + return func(c *libpod.Container) bool { + return !filters.MatchLabelFilters(filterValues, c.Labels()) }, nil case "until": return prepareUntilFilterFunc(filterValues) |