Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consolidate filter logic to pkg subdirectory #8809

Merged
merged 1 commit into from
Dec 30, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions cmd/podman/system/prune.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import (
"github.com/containers/podman/v2/cmd/podman/registry"
"github.com/containers/podman/v2/cmd/podman/utils"
"github.com/containers/podman/v2/cmd/podman/validate"
lpfilters "github.com/containers/podman/v2/libpod/filters"
"github.com/containers/podman/v2/pkg/domain/entities"
dfilters "github.com/containers/podman/v2/pkg/domain/filters"
"github.com/spf13/cobra"
)

Expand Down Expand Up @@ -80,7 +80,7 @@ Are you sure you want to continue? [y/N] `, volumeString)
}
}

pruneOptions.Filters, err = lpfilters.ParseFilterArgumentsIntoFilters(filters)
pruneOptions.Filters, err = dfilters.ParseFilterArgumentsIntoFilters(filters)
if err != nil {
return err
}
Expand Down
20 changes: 0 additions & 20 deletions libpod/filters/helpers.go

This file was deleted.

4 changes: 2 additions & 2 deletions pkg/api/handlers/compat/containers_prune.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import (
"net/http"

"github.com/containers/podman/v2/libpod"
lpfilters "github.com/containers/podman/v2/libpod/filters"
"github.com/containers/podman/v2/pkg/api/handlers/utils"
"github.com/containers/podman/v2/pkg/domain/entities"
"github.com/containers/podman/v2/pkg/domain/filters"
"github.com/docker/docker/api/types"
"github.com/gorilla/schema"
"github.com/pkg/errors"
Expand All @@ -29,7 +29,7 @@ func PruneContainers(w http.ResponseWriter, r *http.Request) {
}
filterFuncs := make([]libpod.ContainerFilter, 0, len(query.Filters))
for k, v := range query.Filters {
generatedFunc, err := lpfilters.GenerateContainerFilterFuncs(k, v, runtime)
generatedFunc, err := filters.GenerateContainerFilterFuncs(k, v, runtime)
if err != nil {
utils.InternalServerError(w, err)
return
Expand Down
4 changes: 2 additions & 2 deletions pkg/api/handlers/utils/pods.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"net/http"

"github.com/containers/podman/v2/libpod"
lpfilters "github.com/containers/podman/v2/libpod/filters"
"github.com/containers/podman/v2/pkg/domain/entities"
dfilters "github.com/containers/podman/v2/pkg/domain/filters"
"github.com/gorilla/schema"
)

Expand All @@ -31,7 +31,7 @@ func GetPods(w http.ResponseWriter, r *http.Request) ([]*entities.ListPodsReport

filters := make([]libpod.PodFilter, 0, len(query.Filters))
for k, v := range query.Filters {
f, err := lpfilters.GeneratePodFilterFunc(k, v)
f, err := dfilters.GeneratePodFilterFunc(k, v)
if err != nil {
return nil, err
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package lpfilters
package filters

import (
"strconv"
Expand Down
2 changes: 1 addition & 1 deletion libpod/filters/pods.go → pkg/domain/filters/pods.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package lpfilters
package filters

import (
"strconv"
Expand Down
4 changes: 2 additions & 2 deletions pkg/domain/infra/abi/containers.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ import (
"github.com/containers/podman/v2/libpod"
"github.com/containers/podman/v2/libpod/define"
"github.com/containers/podman/v2/libpod/events"
lpfilters "github.com/containers/podman/v2/libpod/filters"
"github.com/containers/podman/v2/libpod/image"
"github.com/containers/podman/v2/libpod/logs"
"github.com/containers/podman/v2/pkg/cgroups"
"github.com/containers/podman/v2/pkg/checkpoint"
"github.com/containers/podman/v2/pkg/domain/entities"
dfilters "github.com/containers/podman/v2/pkg/domain/filters"
"github.com/containers/podman/v2/pkg/domain/infra/abi/terminal"
parallelctr "github.com/containers/podman/v2/pkg/parallel/ctr"
"github.com/containers/podman/v2/pkg/ps"
Expand Down Expand Up @@ -207,7 +207,7 @@ func (ic *ContainerEngine) ContainerStop(ctx context.Context, namesOrIds []strin
func (ic *ContainerEngine) ContainerPrune(ctx context.Context, options entities.ContainerPruneOptions) (*entities.ContainerPruneReport, error) {
filterFuncs := make([]libpod.ContainerFilter, 0, len(options.Filters))
for k, v := range options.Filters {
generatedFunc, err := lpfilters.GenerateContainerFilterFuncs(k, v, ic.Libpod)
generatedFunc, err := dfilters.GenerateContainerFilterFuncs(k, v, ic.Libpod)
if err != nil {
return nil, err
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/domain/infra/abi/pods.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (

"github.com/containers/podman/v2/libpod"
"github.com/containers/podman/v2/libpod/define"
lpfilters "github.com/containers/podman/v2/libpod/filters"
"github.com/containers/podman/v2/pkg/domain/entities"
dfilters "github.com/containers/podman/v2/pkg/domain/filters"
"github.com/containers/podman/v2/pkg/signal"
"github.com/containers/podman/v2/pkg/specgen"
"github.com/containers/podman/v2/pkg/specgen/generate"
Expand Down Expand Up @@ -288,7 +288,7 @@ func (ic *ContainerEngine) PodPs(ctx context.Context, options entities.PodPSOpti

filters := make([]libpod.PodFilter, 0, len(options.Filters))
for k, v := range options.Filters {
f, err := lpfilters.GeneratePodFilterFunc(k, v)
f, err := dfilters.GeneratePodFilterFunc(k, v)
if err != nil {
return nil, err
}
Expand Down
6 changes: 3 additions & 3 deletions pkg/ps/ps.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import (

"github.com/containers/podman/v2/libpod"
"github.com/containers/podman/v2/libpod/define"
lpfilters "github.com/containers/podman/v2/libpod/filters"
"github.com/containers/podman/v2/pkg/domain/entities"
"github.com/containers/podman/v2/pkg/domain/filters"
psdefine "github.com/containers/podman/v2/pkg/ps/define"
"github.com/containers/storage"
"github.com/pkg/errors"
Expand All @@ -27,7 +27,7 @@ func GetContainerLists(runtime *libpod.Runtime, options entities.ContainerListOp
all := options.All || options.Last > 0
if len(options.Filters) > 0 {
for k, v := range options.Filters {
generatedFunc, err := lpfilters.GenerateContainerFilterFuncs(k, v, runtime)
generatedFunc, err := filters.GenerateContainerFilterFuncs(k, v, runtime)
if err != nil {
return nil, err
}
Expand All @@ -41,7 +41,7 @@ func GetContainerLists(runtime *libpod.Runtime, options entities.ContainerListOp
all = true
}
if !all {
runningOnly, err := lpfilters.GenerateContainerFilterFuncs("status", []string{define.ContainerStateRunning.String()}, runtime)
runningOnly, err := filters.GenerateContainerFilterFuncs("status", []string{define.ContainerStateRunning.String()}, runtime)
if err != nil {
return nil, err
}
Expand Down