From 37f3b191d5318b7d25893eabf4e57b568c326773 Mon Sep 17 00:00:00 2001 From: Sujil02 Date: Thu, 2 Apr 2020 22:56:59 -0400 Subject: Add pod prune for api v2. Add the ability to prune pods for api v2, Includes the addition of force flag, for client side prompt. Update test suite to support this use case. Signed-off-by: Sujil02 --- pkg/domain/infra/abi/pods.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'pkg/domain/infra/abi') diff --git a/pkg/domain/infra/abi/pods.go b/pkg/domain/infra/abi/pods.go index 59bf0f636..6b6e13e24 100644 --- a/pkg/domain/infra/abi/pods.go +++ b/pkg/domain/infra/abi/pods.go @@ -243,6 +243,23 @@ func (ic *ContainerEngine) PodRm(ctx context.Context, namesOrIds []string, optio return reports, nil } +func (ic *ContainerEngine) PodPrune(ctx context.Context, options entities.PodPruneOptions) ([]*entities.PodPruneReport, error) { + var ( + reports []*entities.PodPruneReport + ) + response, err := ic.Libpod.PrunePods(ctx) + if err != nil { + return nil, err + } + for k, v := range response { + reports = append(reports, &entities.PodPruneReport{ + Err: v, + Id: k, + }) + } + return reports, nil +} + func (ic *ContainerEngine) PodCreate(ctx context.Context, opts entities.PodCreateOptions) (*entities.PodCreateReport, error) { podSpec := specgen.NewPodSpecGenerator() opts.ToPodSpecGen(podSpec) -- cgit v1.2.3-54-g00ecf