From 7cbc09971a4d7322a6b29d86ef1d1fcb71f68f04 Mon Sep 17 00:00:00 2001 From: Sujil02 Date: Tue, 31 Mar 2020 00:53:50 -0400 Subject: podmanv2 pod inspect Add the ability to inspect pod in podmanv2 Signed-off-by: Sujil02 --- pkg/domain/infra/abi/pods.go | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'pkg/domain/infra/abi') 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 +} -- cgit v1.2.3-54-g00ecf