Skip to content

Commit

Permalink
Merge pull request #3080 from baude/remotepsnamespace
Browse files Browse the repository at this point in the history
fix podman-remote ps --ns
  • Loading branch information
openshift-merge-robot authored May 7, 2019
2 parents 7b67c96 + 2dfb744 commit 2e40bde
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
2 changes: 1 addition & 1 deletion cmd/podman/ps.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down
5 changes: 5 additions & 0 deletions pkg/adapter/containers.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
15 changes: 15 additions & 0 deletions pkg/adapter/containers_remote.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

0 comments on commit 2e40bde

Please sign in to comment.