summaryrefslogtreecommitdiff
path: root/pkg/domain/infra
diff options
context:
space:
mode:
authorSujil02 <sushah@redhat.com>2020-03-31 00:53:50 -0400
committerSujil02 <sushah@redhat.com>2020-04-01 15:10:49 -0400
commit7cbc09971a4d7322a6b29d86ef1d1fcb71f68f04 (patch)
treeb8d482db0ee3f9d119ef208bae7ed03332aa0455 /pkg/domain/infra
parent0a163720351710be314c729086e8d288680ff0a8 (diff)
downloadpodman-7cbc09971a4d7322a6b29d86ef1d1fcb71f68f04.tar.gz
podman-7cbc09971a4d7322a6b29d86ef1d1fcb71f68f04.tar.bz2
podman-7cbc09971a4d7322a6b29d86ef1d1fcb71f68f04.zip
podmanv2 pod inspect
Add the ability to inspect pod in podmanv2 Signed-off-by: Sujil02 <sushah@redhat.com>
Diffstat (limited to 'pkg/domain/infra')
-rw-r--r--pkg/domain/infra/abi/pods.go21
-rw-r--r--pkg/domain/infra/tunnel/pods.go10
2 files changed, 31 insertions, 0 deletions
diff --git a/pkg/domain/infra/abi/pods.go b/pkg/domain/infra/abi/pods.go
index 494a048ec..073cd8d5c 100644
--- a/pkg/domain/infra/abi/pods.go
+++ b/pkg/domain/infra/abi/pods.go
@@ -331,3 +331,24 @@ func (ic *ContainerEngine) PodPs(ctx context.Context, options entities.PodPSOpti
}
return reports, nil
}
+
+func (ic *ContainerEngine) PodInspect(ctx context.Context, options entities.PodInspectOptions) (*entities.PodInspectReport, error) {
+ var (
+ pod *libpod.Pod
+ err error
+ )
+ // Look up the pod.
+ if options.Latest {
+ pod, err = ic.Libpod.GetLatestPod()
+ } else {
+ pod, err = ic.Libpod.LookupPod(options.NameOrID)
+ }
+ if err != nil {
+ return nil, errors.Wrap(err, "unable to lookup requested container")
+ }
+ inspect, err := pod.Inspect()
+ if err != nil {
+ return nil, err
+ }
+ return &entities.PodInspectReport{PodInspect: inspect}, nil
+}
diff --git a/pkg/domain/infra/tunnel/pods.go b/pkg/domain/infra/tunnel/pods.go
index ad87a0a29..dad77284f 100644
--- a/pkg/domain/infra/tunnel/pods.go
+++ b/pkg/domain/infra/tunnel/pods.go
@@ -197,3 +197,13 @@ func (ic *ContainerEngine) PodTop(ctx context.Context, options entities.PodTopOp
func (ic *ContainerEngine) PodPs(ctx context.Context, options entities.PodPSOptions) ([]*entities.ListPodsReport, error) {
return pods.List(ic.ClientCxt, options.Filters)
}
+
+func (ic *ContainerEngine) PodInspect(ctx context.Context, options entities.PodInspectOptions) (*entities.PodInspectReport, error) {
+ switch {
+ case options.Latest:
+ return nil, errors.New("latest is not supported")
+ case options.NameOrID == "":
+ return nil, errors.New("NameOrID must be specified")
+ }
+ return pods.Inspect(ic.ClientCxt, options.NameOrID)
+}