diff options
author | baude <bbaude@redhat.com> | 2019-05-07 11:09:33 -0500 |
---|---|---|
committer | baude <bbaude@redhat.com> | 2019-05-07 12:38:58 -0500 |
commit | 2dfb744d8cae8e324676efcd845055f3cb0353bb (patch) | |
tree | 949610eee1f98f708fdf59dd8a33d9b3ad3e1e30 | |
parent | 3b5ac1818f09514039fdfec20aa874ae68e6ab7c (diff) | |
download | podman-2dfb744d8cae8e324676efcd845055f3cb0353bb.tar.gz podman-2dfb744d8cae8e324676efcd845055f3cb0353bb.tar.bz2 podman-2dfb744d8cae8e324676efcd845055f3cb0353bb.zip |
fix podman-remote ps --ns
the namespace for the remote client was being incorrectly derived from
the "remote" client.
fixes: #2938
Signed-off-by: baude <bbaude@redhat.com>
-rw-r--r-- | cmd/podman/ps.go | 2 | ||||
-rw-r--r-- | pkg/adapter/containers.go | 5 | ||||
-rw-r--r-- | pkg/adapter/containers_remote.go | 15 |
3 files changed, 21 insertions, 1 deletions
diff --git a/cmd/podman/ps.go b/cmd/podman/ps.go index 623f17050..eb5181126 100644 --- a/cmd/podman/ps.go +++ b/cmd/podman/ps.go @@ -497,7 +497,7 @@ func psDisplay(c *cliconfig.PsValues, runtime *adapter.LocalRuntime) error { } else { // Print namespace information - ns := shared.GetNamespaces(container.Pid) + ns := runtime.GetNamespaces(container) fmt.Fprintf(w, "\n%s\t%s\t%d\t%s\t%s\t%s\t%s\t%s\t%s\t%s", container.ID, container.Names, container.Pid, ns.Cgroup, ns.IPC, ns.MNT, ns.NET, ns.PIDNS, ns.User, ns.UTS) } diff --git a/pkg/adapter/containers.go b/pkg/adapter/containers.go index 0721af773..82d999202 100644 --- a/pkg/adapter/containers.go +++ b/pkg/adapter/containers.go @@ -1022,3 +1022,8 @@ func (r *LocalRuntime) GenerateSystemd(c *cliconfig.GenerateSystemdValues) (stri } return systemdgen.CreateSystemdUnitAsString(name, ctr.ID(), c.RestartPolicy, ctr.Config().StaticDir, timeout) } + +// GetNamespaces returns namespace information about a container for PS +func (r *LocalRuntime) GetNamespaces(container shared.PsContainerOutput) *shared.Namespace { + return shared.GetNamespaces(container.Pid) +} diff --git a/pkg/adapter/containers_remote.go b/pkg/adapter/containers_remote.go index 201249fc3..c70db13ed 100644 --- a/pkg/adapter/containers_remote.go +++ b/pkg/adapter/containers_remote.go @@ -961,3 +961,18 @@ func (r *LocalRuntime) Port(c *cliconfig.PortValues) ([]*Container, error) { func (r *LocalRuntime) GenerateSystemd(c *cliconfig.GenerateSystemdValues) (string, error) { return iopodman.GenerateSystemd().Call(r.Conn, c.InputArgs[0], c.RestartPolicy, int64(c.StopTimeout), c.Name) } + +// GetNamespaces returns namespace information about a container for PS +func (r *LocalRuntime) GetNamespaces(container shared.PsContainerOutput) *shared.Namespace { + ns := shared.Namespace{ + PID: container.PID, + Cgroup: container.Cgroup, + IPC: container.IPC, + MNT: container.MNT, + NET: container.NET, + PIDNS: container.PIDNS, + User: container.User, + UTS: container.UTS, + } + return &ns +} |