diff options
author | Brent Baude <bbaude@redhat.com> | 2020-04-04 13:59:55 -0500 |
---|---|---|
committer | Brent Baude <bbaude@redhat.com> | 2020-04-06 12:12:59 -0500 |
commit | b22254dc8bfdea5153761e93298182286f874bac (patch) | |
tree | 16ff841496724a6b600824d06900a075d429e7dc /pkg/domain/infra | |
parent | e318b09b6800ddb013ddf3b9a2fb99ebc55bd920 (diff) | |
download | podman-b22254dc8bfdea5153761e93298182286f874bac.tar.gz podman-b22254dc8bfdea5153761e93298182286f874bac.tar.bz2 podman-b22254dc8bfdea5153761e93298182286f874bac.zip |
podmanv2 ps
add the ability to list containers
Signed-off-by: Brent Baude <bbaude@redhat.com>
Diffstat (limited to 'pkg/domain/infra')
-rw-r--r-- | pkg/domain/infra/abi/containers.go | 5 | ||||
-rw-r--r-- | pkg/domain/infra/abi/pods.go | 5 | ||||
-rw-r--r-- | pkg/domain/infra/tunnel/containers.go | 9 | ||||
-rw-r--r-- | pkg/domain/infra/tunnel/helpers.go | 5 |
4 files changed, 16 insertions, 8 deletions
diff --git a/pkg/domain/infra/abi/containers.go b/pkg/domain/infra/abi/containers.go index 929c3f335..54f91a189 100644 --- a/pkg/domain/infra/abi/containers.go +++ b/pkg/domain/infra/abi/containers.go @@ -17,6 +17,7 @@ import ( "github.com/containers/libpod/pkg/checkpoint" "github.com/containers/libpod/pkg/domain/entities" "github.com/containers/libpod/pkg/domain/infra/abi/terminal" + "github.com/containers/libpod/pkg/ps" "github.com/containers/libpod/pkg/signal" "github.com/containers/libpod/pkg/specgen" "github.com/containers/libpod/pkg/specgen/generate" @@ -617,3 +618,7 @@ func (ic *ContainerEngine) ContainerStart(ctx context.Context, namesOrIds []stri } return reports, nil } + +func (ic *ContainerEngine) ContainerList(ctx context.Context, options entities.ContainerListOptions) ([]entities.ListContainer, error) { + return ps.GetContainerLists(ic.Libpod, options) +} diff --git a/pkg/domain/infra/abi/pods.go b/pkg/domain/infra/abi/pods.go index 073cd8d5c..c3e5d59bc 100644 --- a/pkg/domain/infra/abi/pods.go +++ b/pkg/domain/infra/abi/pods.go @@ -5,9 +5,10 @@ package abi import ( "context" + lpfilters "github.com/containers/libpod/libpod/filters" + "github.com/containers/libpod/libpod" "github.com/containers/libpod/libpod/define" - "github.com/containers/libpod/libpod/podfilters" "github.com/containers/libpod/pkg/domain/entities" "github.com/containers/libpod/pkg/signal" "github.com/containers/libpod/pkg/specgen" @@ -281,7 +282,7 @@ func (ic *ContainerEngine) PodPs(ctx context.Context, options entities.PodPSOpti ) for k, v := range options.Filters { for _, filter := range v { - f, err := podfilters.GeneratePodFilterFunc(k, filter) + f, err := lpfilters.GeneratePodFilterFunc(k, filter) if err != nil { return nil, err } diff --git a/pkg/domain/infra/tunnel/containers.go b/pkg/domain/infra/tunnel/containers.go index 4101068ba..b6807d5b6 100644 --- a/pkg/domain/infra/tunnel/containers.go +++ b/pkg/domain/infra/tunnel/containers.go @@ -7,7 +7,6 @@ import ( "github.com/containers/image/v5/docker/reference" "github.com/containers/libpod/libpod/define" - "github.com/containers/libpod/pkg/api/handlers/libpod" "github.com/containers/libpod/pkg/bindings/containers" "github.com/containers/libpod/pkg/domain/entities" "github.com/containers/libpod/pkg/specgen" @@ -233,7 +232,7 @@ func (ic *ContainerEngine) ContainerCheckpoint(ctx context.Context, namesOrIds [ var ( reports []*entities.CheckpointReport err error - ctrs []libpod.ListContainer + ctrs []entities.ListContainer ) if options.All { @@ -268,7 +267,7 @@ func (ic *ContainerEngine) ContainerRestore(ctx context.Context, namesOrIds []st var ( reports []*entities.RestoreReport err error - ctrs []libpod.ListContainer + ctrs []entities.ListContainer ) if options.All { allCtrs, err := getContainersByContext(ic.ClientCxt, true, []string{}) @@ -317,3 +316,7 @@ func (ic *ContainerEngine) ContainerExec(ctx context.Context, nameOrId string, o func (ic *ContainerEngine) ContainerStart(ctx context.Context, namesOrIds []string, options entities.ContainerStartOptions) ([]*entities.ContainerStartReport, error) { return nil, errors.New("not implemented") } + +func (ic *ContainerEngine) ContainerList(ctx context.Context, options entities.ContainerListOptions) ([]entities.ListContainer, error) { + return containers.List(ic.ClientCxt, options.Filters, &options.All, &options.Last, &options.Pod, &options.Size, &options.Sync) +} diff --git a/pkg/domain/infra/tunnel/helpers.go b/pkg/domain/infra/tunnel/helpers.go index f9183c955..682d60d6a 100644 --- a/pkg/domain/infra/tunnel/helpers.go +++ b/pkg/domain/infra/tunnel/helpers.go @@ -5,7 +5,6 @@ import ( "strings" "github.com/containers/libpod/libpod/define" - "github.com/containers/libpod/pkg/api/handlers/libpod" "github.com/containers/libpod/pkg/bindings" "github.com/containers/libpod/pkg/bindings/containers" "github.com/containers/libpod/pkg/bindings/pods" @@ -14,9 +13,9 @@ import ( "github.com/pkg/errors" ) -func getContainersByContext(contextWithConnection context.Context, all bool, namesOrIds []string) ([]libpod.ListContainer, error) { +func getContainersByContext(contextWithConnection context.Context, all bool, namesOrIds []string) ([]entities.ListContainer, error) { var ( - cons []libpod.ListContainer + cons []entities.ListContainer ) if all && len(namesOrIds) > 0 { return nil, errors.New("cannot lookup containers and all") |