summaryrefslogtreecommitdiff
path: root/libpod
diff options
context:
space:
mode:
authorBaron Lenardson <lenardson.baron@gmail.com>2020-12-21 10:35:21 -0600
committerBaron Lenardson <lenardson.baron@gmail.com>2020-12-21 10:55:39 -0600
commit5923656f321a9ca7b222c81cdb5f3387cc7cd3ad (patch)
tree47dfe20988b8ebf512ed769f42ed581a15d90b66 /libpod
parent5c6b5ef34905f40562b518799c35be8d06694e65 (diff)
downloadpodman-5923656f321a9ca7b222c81cdb5f3387cc7cd3ad.tar.gz
podman-5923656f321a9ca7b222c81cdb5f3387cc7cd3ad.tar.bz2
podman-5923656f321a9ca7b222c81cdb5f3387cc7cd3ad.zip
Add volume filters to system prune
This change was missed in pull/8689. Now that volume pruneing supports filters system pruneing can pass its filters down to the volume pruneing. Additionally this change adds tests for the following components * podman system prune subcommand with `--volumes` & `--filter` options * apiv2 api tests for `/system/` and `/libpod/system` endpoints Relates to #8453, #8672 Signed-off-by: Baron Lenardson <lenardson.baron@gmail.com>
Diffstat (limited to 'libpod')
-rw-r--r--libpod/filters/helpers.go20
1 files changed, 20 insertions, 0 deletions
diff --git a/libpod/filters/helpers.go b/libpod/filters/helpers.go
new file mode 100644
index 000000000..859db3a9a
--- /dev/null
+++ b/libpod/filters/helpers.go
@@ -0,0 +1,20 @@
+package lpfilters
+
+import (
+ "net/url"
+ "strings"
+
+ "github.com/pkg/errors"
+)
+
+func ParseFilterArgumentsIntoFilters(filters []string) (url.Values, error) {
+ parsedFilters := make(url.Values)
+ for _, f := range filters {
+ t := strings.SplitN(f, "=", 2)
+ if len(t) < 2 {
+ return parsedFilters, errors.Errorf("filter input must be in the form of filter=value: %s is invalid", f)
+ }
+ parsedFilters.Add(t[0], t[1])
+ }
+ return parsedFilters, nil
+}