summaryrefslogtreecommitdiff
path: root/pkg/domain/infra/abi
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-04-15 13:42:36 -0700
committerGitHub <noreply@github.com>2020-04-15 13:42:36 -0700
commit6e9622aa987bba37026fe628bffb5958d4cf64cb (patch)
tree90389ebb3a7ba54080cec8c05bca4435f3e66bba /pkg/domain/infra/abi
parent195cb11276d61311bbd2b5274ac7a98b62abaaba (diff)
parentec4060aef6c77c049fc2c3b6438ebb5590f6ab69 (diff)
downloadpodman-6e9622aa987bba37026fe628bffb5958d4cf64cb.tar.gz
podman-6e9622aa987bba37026fe628bffb5958d4cf64cb.tar.bz2
podman-6e9622aa987bba37026fe628bffb5958d4cf64cb.zip
Merge pull request #5775 from sujil02/v2-container-prune
Ability to prune container in api V2
Diffstat (limited to 'pkg/domain/infra/abi')
-rw-r--r--pkg/domain/infra/abi/containers.go17
1 files changed, 17 insertions, 0 deletions
diff --git a/pkg/domain/infra/abi/containers.go b/pkg/domain/infra/abi/containers.go
index f464df3ac..fc62a6c29 100644
--- a/pkg/domain/infra/abi/containers.go
+++ b/pkg/domain/infra/abi/containers.go
@@ -19,6 +19,7 @@ import (
"github.com/containers/libpod/libpod/events"
"github.com/containers/libpod/libpod/image"
"github.com/containers/libpod/libpod/logs"
+ "github.com/containers/libpod/pkg/api/handlers/utils"
"github.com/containers/libpod/pkg/checkpoint"
"github.com/containers/libpod/pkg/domain/entities"
"github.com/containers/libpod/pkg/domain/infra/abi/terminal"
@@ -173,6 +174,22 @@ func (ic *ContainerEngine) ContainerStop(ctx context.Context, namesOrIds []strin
return reports, nil
}
+func (ic *ContainerEngine) ContainerPrune(ctx context.Context, options entities.ContainerPruneOptions) (*entities.ContainerPruneReport, error) {
+ filterFuncs, err := utils.GenerateFilterFuncsFromMap(ic.Libpod, options.Filters)
+ if err != nil {
+ return nil, err
+ }
+ prunedContainers, pruneErrors, err := ic.Libpod.PruneContainers(filterFuncs)
+ if err != nil {
+ return nil, err
+ }
+ report := entities.ContainerPruneReport{
+ ID: prunedContainers,
+ Err: pruneErrors,
+ }
+ return &report, nil
+}
+
func (ic *ContainerEngine) ContainerKill(ctx context.Context, namesOrIds []string, options entities.KillOptions) ([]*entities.KillReport, error) {
var (
reports []*entities.KillReport