diff options
author | baude <bbaude@redhat.com> | 2019-04-24 15:57:37 -0500 |
---|---|---|
committer | baude <bbaude@redhat.com> | 2019-04-25 14:44:14 -0500 |
commit | c4dd7c5813078acbe871aae37644bfff3163d160 (patch) | |
tree | 779caad2670afddd36621cbee9198a913d4b7c3f /pkg/adapter/containers.go | |
parent | a01c62fcbde1afdc77aa05b71c3c84ddacf7fc55 (diff) | |
download | podman-c4dd7c5813078acbe871aae37644bfff3163d160.tar.gz podman-c4dd7c5813078acbe871aae37644bfff3163d160.tar.bz2 podman-c4dd7c5813078acbe871aae37644bfff3163d160.zip |
enable podman remote top
add the ability for the remote client to display a container's running
processes.
Signed-off-by: baude <bbaude@redhat.com>
Diffstat (limited to 'pkg/adapter/containers.go')
-rw-r--r-- | pkg/adapter/containers.go | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/pkg/adapter/containers.go b/pkg/adapter/containers.go index 8481a0cec..9f5fc7e65 100644 --- a/pkg/adapter/containers.go +++ b/pkg/adapter/containers.go @@ -766,3 +766,23 @@ func (r *LocalRuntime) Restart(ctx context.Context, c *cliconfig.RestartValues) } return pool.Run() } + +// Top display the running processes of a container +func (r *LocalRuntime) Top(cli *cliconfig.TopValues) ([]string, error) { + var ( + descriptors []string + container *libpod.Container + err error + ) + if cli.Latest { + descriptors = cli.InputArgs + container, err = r.Runtime.GetLatestContainer() + } else { + descriptors = cli.InputArgs[1:] + container, err = r.Runtime.LookupContainer(cli.InputArgs[0]) + } + if err != nil { + return nil, errors.Wrapf(err, "unable to lookup requested container") + } + return container.Top(descriptors) +} |