summaryrefslogtreecommitdiff
path: root/pkg/varlinkapi/volumes.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-03-24 23:20:25 +0100
committerGitHub <noreply@github.com>2020-03-24 23:20:25 +0100
commitb4520649af59780df494d75f50d0b5081eafff04 (patch)
tree5edd6e5fd01f12154c82146ce6170aaf7d716e19 /pkg/varlinkapi/volumes.go
parent0c084d9719772a9b68d5eb67114cf5bf001958b2 (diff)
parentae614920bfe2510ca6d1dd6cea02bbe17ddb245c (diff)
downloadpodman-b4520649af59780df494d75f50d0b5081eafff04.tar.gz
podman-b4520649af59780df494d75f50d0b5081eafff04.tar.bz2
podman-b4520649af59780df494d75f50d0b5081eafff04.zip
Merge pull request #5593 from baude/v2volumes
podmanv2 volumes
Diffstat (limited to 'pkg/varlinkapi/volumes.go')
-rw-r--r--pkg/varlinkapi/volumes.go24
1 files changed, 14 insertions, 10 deletions
diff --git a/pkg/varlinkapi/volumes.go b/pkg/varlinkapi/volumes.go
index 2dddd3008..cbb4a70cc 100644
--- a/pkg/varlinkapi/volumes.go
+++ b/pkg/varlinkapi/volumes.go
@@ -105,16 +105,20 @@ func (i *LibpodAPI) InspectVolume(call iopodman.VarlinkCall, name string) error
// VolumesPrune removes unused images via a varlink call
func (i *LibpodAPI) VolumesPrune(call iopodman.VarlinkCall) error {
- var errs []string
- prunedNames, prunedErrors := i.Runtime.PruneVolumes(getContext())
- if len(prunedErrors) == 0 {
- return call.ReplyVolumesPrune(prunedNames, []string{})
+ var (
+ prunedErrors []string
+ prunedNames []string
+ )
+ responses, err := i.Runtime.PruneVolumes(getContext())
+ if err != nil {
+ return call.ReplyVolumesPrune([]string{}, []string{err.Error()})
}
-
- // We need to take the errors and capture their strings to go back over
- // varlink
- for _, e := range prunedErrors {
- errs = append(errs, e.Error())
+ for _, i := range responses {
+ if i.Err == nil {
+ prunedNames = append(prunedNames, i.Id)
+ } else {
+ prunedErrors = append(prunedErrors, i.Err.Error())
+ }
}
- return call.ReplyVolumesPrune(prunedNames, errs)
+ return call.ReplyVolumesPrune(prunedNames, prunedErrors)
}