summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2019-01-11 06:18:29 -0800
committerGitHub <noreply@github.com>2019-01-11 06:18:29 -0800
commit28c35cab8750f379a418e87ed6bd874a12ec158d (patch)
treed36fc6dc22b1461494e99268b2999344de7baafa /cmd
parent9368c24be6f289d21a0065df24471268ead59664 (diff)
parent7459c48863acea8453e0800124006a90ca82f646 (diff)
downloadpodman-28c35cab8750f379a418e87ed6bd874a12ec158d.tar.gz
podman-28c35cab8750f379a418e87ed6bd874a12ec158d.tar.bz2
podman-28c35cab8750f379a418e87ed6bd874a12ec158d.zip
Merge pull request #2135 from baude/varlinkprune
Add varlink support for prune
Diffstat (limited to 'cmd')
-rw-r--r--cmd/podman/images_prune.go15
-rw-r--r--cmd/podman/shared/prune.go24
-rw-r--r--cmd/podman/varlink/io.podman.varlink4
3 files changed, 17 insertions, 26 deletions
diff --git a/cmd/podman/images_prune.go b/cmd/podman/images_prune.go
index cb72a498f..06879e02d 100644
--- a/cmd/podman/images_prune.go
+++ b/cmd/podman/images_prune.go
@@ -1,8 +1,8 @@
package main
import (
+ "fmt"
"github.com/containers/libpod/cmd/podman/libpodruntime"
- "github.com/containers/libpod/cmd/podman/shared"
"github.com/pkg/errors"
"github.com/urfave/cli"
)
@@ -30,5 +30,16 @@ func pruneImagesCmd(c *cli.Context) error {
}
defer runtime.Shutdown(false)
- return shared.Prune(runtime.ImageRuntime())
+ pruneImages, err := runtime.ImageRuntime().GetPruneImages()
+ if err != nil {
+ return err
+ }
+
+ for _, i := range pruneImages {
+ if err := i.Remove(true); err != nil {
+ return errors.Wrapf(err, "failed to remove %s", i.ID())
+ }
+ fmt.Println(i.ID())
+ }
+ return nil
}
diff --git a/cmd/podman/shared/prune.go b/cmd/podman/shared/prune.go
deleted file mode 100644
index 90cfe4475..000000000
--- a/cmd/podman/shared/prune.go
+++ /dev/null
@@ -1,24 +0,0 @@
-package shared
-
-import (
- "fmt"
- "github.com/pkg/errors"
-
- "github.com/containers/libpod/libpod/image"
-)
-
-// Prune removes all unnamed and unused images from the local store
-func Prune(ir *image.Runtime) error {
- pruneImages, err := ir.GetPruneImages()
- if err != nil {
- return err
- }
-
- for _, i := range pruneImages {
- if err := i.Remove(true); err != nil {
- return errors.Wrapf(err, "failed to remove %s", i.ID())
- }
- fmt.Println(i.ID())
- }
- return nil
-}
diff --git a/cmd/podman/varlink/io.podman.varlink b/cmd/podman/varlink/io.podman.varlink
index b7972a918..a3e8c050e 100644
--- a/cmd/podman/varlink/io.podman.varlink
+++ b/cmd/podman/varlink/io.podman.varlink
@@ -1016,6 +1016,10 @@ method MountContainer(name: string) -> (path: string)
# ~~~
method UnmountContainer(name: string, force: bool) -> ()
+# ImagesPrune removes all unused images from the local store. Upon successful pruning,
+# the IDs of the removed images are returned.
+method ImagesPrune() -> (pruned: []string)
+
# This function is not implemented yet.
method ListContainerPorts(name: string) -> (notimplemented: NotImplemented)