summaryrefslogtreecommitdiff
path: root/libpod/image/prune.go
diff options
context:
space:
mode:
authorNalin Dahyabhai <nalin@redhat.com>2019-04-22 16:41:17 -0400
committerNalin Dahyabhai <nalin@redhat.com>2019-04-25 08:57:58 -0400
commit5c81a117f16fde190acef331f5b88022fe11c550 (patch)
treea8aa0f3baaf59bf05e10479abc5a1d89206a0e80 /libpod/image/prune.go
parentb01fdcbbd5344e89c3d9f3462c1df1764277d9fd (diff)
downloadpodman-5c81a117f16fde190acef331f5b88022fe11c550.tar.gz
podman-5c81a117f16fde190acef331f5b88022fe11c550.tar.bz2
podman-5c81a117f16fde190acef331f5b88022fe11c550.zip
images: add context to GetParent/IsParent/Remove/Prune...
Add a context.Context parameter to Image.GetParent(), Image.IsParent(), Image.GetChildren(), Image.Remove(), and Runtime.PruneImages(). Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
Diffstat (limited to 'libpod/image/prune.go')
-rw-r--r--libpod/image/prune.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/libpod/image/prune.go b/libpod/image/prune.go
index 5bd3c2c99..a4f8a0c9f 100644
--- a/libpod/image/prune.go
+++ b/libpod/image/prune.go
@@ -1,6 +1,8 @@
package image
import (
+ "context"
+
"github.com/containers/libpod/libpod/events"
"github.com/pkg/errors"
)
@@ -34,14 +36,14 @@ func (ir *Runtime) GetPruneImages(all bool) ([]*Image, error) {
// PruneImages prunes dangling and optionally all unused images from the local
// image store
-func (ir *Runtime) PruneImages(all bool) ([]string, error) {
+func (ir *Runtime) PruneImages(ctx context.Context, all bool) ([]string, error) {
var prunedCids []string
pruneImages, err := ir.GetPruneImages(all)
if err != nil {
return nil, errors.Wrap(err, "unable to get images to prune")
}
for _, p := range pruneImages {
- if err := p.Remove(true); err != nil {
+ if err := p.Remove(ctx, true); err != nil {
return nil, errors.Wrap(err, "failed to prune image")
}
defer p.newImageEvent(events.Prune)