summaryrefslogtreecommitdiff
path: root/pkg/domain
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2021-06-23 15:52:30 -0400
committerGitHub <noreply@github.com>2021-06-23 15:52:30 -0400
commitd95ff1a687c12e794e808a8a535e2ab5a2becd03 (patch)
treed1dd83249af95606c99363fa89a6a5afbe66c97f /pkg/domain
parent3f3feaa015af6e0831daf039f1cd5a0cba3de6c2 (diff)
parenta0b24de32fa3459ab01d3f667384c51b0d7e43d0 (diff)
downloadpodman-d95ff1a687c12e794e808a8a535e2ab5a2becd03.tar.gz
podman-d95ff1a687c12e794e808a8a535e2ab5a2becd03.tar.bz2
podman-d95ff1a687c12e794e808a8a535e2ab5a2becd03.zip
Merge pull request #10756 from jmguzik/volume-prune-until-http-api
Add support for volume prune until filter to http api
Diffstat (limited to 'pkg/domain')
-rw-r--r--pkg/domain/filters/volumes.go15
1 files changed, 13 insertions, 2 deletions
diff --git a/pkg/domain/filters/volumes.go b/pkg/domain/filters/volumes.go
index 9a08adf82..df23c31c0 100644
--- a/pkg/domain/filters/volumes.go
+++ b/pkg/domain/filters/volumes.go
@@ -86,11 +86,22 @@ func GeneratePruneVolumeFilters(filters url.Values) ([]libpod.VolumeFilter, erro
var vf []libpod.VolumeFilter
for filter, v := range filters {
for _, val := range v {
+ filterVal := val
switch filter {
case "label":
- filter := val
vf = append(vf, func(v *libpod.Volume) bool {
- return util.MatchLabelFilters([]string{filter}, v.Labels())
+ return util.MatchLabelFilters([]string{filterVal}, v.Labels())
+ })
+ case "until":
+ until, err := util.ComputeUntilTimestamp([]string{filterVal})
+ if err != nil {
+ return nil, err
+ }
+ vf = append(vf, func(v *libpod.Volume) bool {
+ if !until.IsZero() && v.CreatedTime().Before(until) {
+ return true
+ }
+ return false
})
default:
return nil, errors.Errorf("%q is an invalid volume filter", filter)