Merge pull request #967 from TomSweeneyRedHat/dev/tsweeney/ps_fix

Add pause state to ps, touchup kpod man page
This commit is contained in:
Daniel J Walsh 2017-10-04 18:27:26 -04:00 committed by GitHub
commit 6657873d9d
2 changed files with 12 additions and 6 deletions

View file

@ -89,8 +89,6 @@ type namespace struct {
UTS string `json:"uts,omitempty"`
}
const runningState = "running"
var (
psFlags = []cli.Flag{
cli.BoolFlag{
@ -271,7 +269,7 @@ func getContainers(containers []*libkpod.ContainerData, opts psOptions) []*libkp
return containers
}
for _, ctr := range containers {
if ctr.State.Status == runningState {
if ctr.State.Status == oci.ContainerStateRunning {
containersOutput = append(containersOutput, ctr)
}
}
@ -295,10 +293,12 @@ func getTemplateOutput(containers []*libkpod.ContainerData, opts psOptions) (psO
ns := getNamespaces(ctr.State.Pid)
switch ctr.State.Status {
case "stopped":
case oci.ContainerStateStopped:
status = "Exited (" + strconv.FormatInt(int64(ctr.State.ExitCode), 10) + ") " + runningFor + " ago"
case runningState:
case oci.ContainerStateRunning:
status = "Up " + runningFor + " ago"
case oci.ContainerStatePaused:
status = "Paused"
default:
status = "Created"
}
@ -385,7 +385,7 @@ func getJSONOutput(containers []*libkpod.ContainerData, nSpace bool) (psOutput [
Names: ctr.Name,
Labels: ctr.Labels,
Mounts: ctr.Mounts,
ContainerRunning: ctr.State.Status == runningState,
ContainerRunning: ctr.State.Status == oci.ContainerStateRunning,
Namespaces: ns,
}
psOutput = append(psOutput, params)

View file

@ -79,6 +79,9 @@ Display the logs of a container
### mount
Mount a working container's root filesystem
### pause
Pause one or more containers
### ps
Prints out information about containers
@ -106,6 +109,9 @@ Display a live stream of one or more containers' resource usage statistics
### stop
Stops one or more running containers.
### unpause
Unpause one or more containers
### tag
Add an additional name to a local image