diff options
Diffstat (limited to 'pkg/domain')
-rw-r--r-- | pkg/domain/infra/abi/containers.go | 12 | ||||
-rw-r--r-- | pkg/domain/infra/abi/network.go | 2 | ||||
-rw-r--r-- | pkg/domain/infra/abi/pods.go | 17 |
3 files changed, 13 insertions, 18 deletions
diff --git a/pkg/domain/infra/abi/containers.go b/pkg/domain/infra/abi/containers.go index 855f9ece8..4b69ac74e 100644 --- a/pkg/domain/infra/abi/containers.go +++ b/pkg/domain/infra/abi/containers.go @@ -205,15 +205,13 @@ func (ic *ContainerEngine) ContainerStop(ctx context.Context, namesOrIds []strin } func (ic *ContainerEngine) ContainerPrune(ctx context.Context, options entities.ContainerPruneOptions) (*entities.ContainerPruneReport, error) { - var filterFuncs []libpod.ContainerFilter + filterFuncs := make([]libpod.ContainerFilter, 0, len(options.Filters)) for k, v := range options.Filters { - for _, val := range v { - generatedFunc, err := lpfilters.GenerateContainerFilterFuncs(k, val, ic.Libpod) - if err != nil { - return nil, err - } - filterFuncs = append(filterFuncs, generatedFunc) + generatedFunc, err := lpfilters.GenerateContainerFilterFuncs(k, v, ic.Libpod) + if err != nil { + return nil, err } + filterFuncs = append(filterFuncs, generatedFunc) } return ic.pruneContainersHelper(filterFuncs) } diff --git a/pkg/domain/infra/abi/network.go b/pkg/domain/infra/abi/network.go index 25ea151e7..c52584565 100644 --- a/pkg/domain/infra/abi/network.go +++ b/pkg/domain/infra/abi/network.go @@ -96,7 +96,7 @@ func (ic *ContainerEngine) NetworkRm(ctx context.Context, namesOrIds []string, o if err := ic.Libpod.RemovePod(ctx, pod, true, true); err != nil { return reports, err } - } else if err := ic.Libpod.RemoveContainer(ctx, c, true, true); err != nil { + } else if err := ic.Libpod.RemoveContainer(ctx, c, true, true); err != nil && errors.Cause(err) != define.ErrNoSuchCtr { return reports, err } } diff --git a/pkg/domain/infra/abi/pods.go b/pkg/domain/infra/abi/pods.go index 258640a81..11374e513 100644 --- a/pkg/domain/infra/abi/pods.go +++ b/pkg/domain/infra/abi/pods.go @@ -282,20 +282,17 @@ func (ic *ContainerEngine) PodTop(ctx context.Context, options entities.PodTopOp func (ic *ContainerEngine) PodPs(ctx context.Context, options entities.PodPSOptions) ([]*entities.ListPodsReport, error) { var ( - err error - filters = []libpod.PodFilter{} - pds = []*libpod.Pod{} + err error + pds = []*libpod.Pod{} ) + filters := make([]libpod.PodFilter, 0, len(options.Filters)) for k, v := range options.Filters { - for _, filter := range v { - f, err := lpfilters.GeneratePodFilterFunc(k, filter) - if err != nil { - return nil, err - } - filters = append(filters, f) - + f, err := lpfilters.GeneratePodFilterFunc(k, v) + if err != nil { + return nil, err } + filters = append(filters, f) } if options.Latest { pod, err := ic.Libpod.GetLatestPod() |