From c4dd7c5813078acbe871aae37644bfff3163d160 Mon Sep 17 00:00:00 2001 From: baude Date: Wed, 24 Apr 2019 15:57:37 -0500 Subject: enable podman remote top add the ability for the remote client to display a container's running processes. Signed-off-by: baude --- pkg/adapter/containers_remote.go | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'pkg/adapter/containers_remote.go') diff --git a/pkg/adapter/containers_remote.go b/pkg/adapter/containers_remote.go index e8f221eaf..ef6d0efe1 100644 --- a/pkg/adapter/containers_remote.go +++ b/pkg/adapter/containers_remote.go @@ -832,3 +832,23 @@ func (r *LocalRuntime) Restart(ctx context.Context, c *cliconfig.RestartValues) } return ok, failures, nil } + +// Top display the running processes of a container +func (r *LocalRuntime) Top(cli *cliconfig.TopValues) ([]string, error) { + var ( + ctr *Container + err error + descriptors []string + ) + if cli.Latest { + ctr, err = r.GetLatestContainer() + descriptors = cli.InputArgs + } else { + ctr, err = r.LookupContainer(cli.InputArgs[0]) + descriptors = cli.InputArgs[1:] + } + if err != nil { + return nil, err + } + return iopodman.Top().Call(r.Conn, ctr.ID(), descriptors) +} -- cgit v1.2.3-54-g00ecf