Merge pull request #967 from TomSweeneyRedHat/dev/tsweeney/ps_fix
Add pause state to ps, touchup kpod man page
This commit is contained in:
commit
6657873d9d
2 changed files with 12 additions and 6 deletions
|
@ -89,8 +89,6 @@ type namespace struct {
|
||||||
UTS string `json:"uts,omitempty"`
|
UTS string `json:"uts,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
const runningState = "running"
|
|
||||||
|
|
||||||
var (
|
var (
|
||||||
psFlags = []cli.Flag{
|
psFlags = []cli.Flag{
|
||||||
cli.BoolFlag{
|
cli.BoolFlag{
|
||||||
|
@ -271,7 +269,7 @@ func getContainers(containers []*libkpod.ContainerData, opts psOptions) []*libkp
|
||||||
return containers
|
return containers
|
||||||
}
|
}
|
||||||
for _, ctr := range containers {
|
for _, ctr := range containers {
|
||||||
if ctr.State.Status == runningState {
|
if ctr.State.Status == oci.ContainerStateRunning {
|
||||||
containersOutput = append(containersOutput, ctr)
|
containersOutput = append(containersOutput, ctr)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -295,10 +293,12 @@ func getTemplateOutput(containers []*libkpod.ContainerData, opts psOptions) (psO
|
||||||
ns := getNamespaces(ctr.State.Pid)
|
ns := getNamespaces(ctr.State.Pid)
|
||||||
|
|
||||||
switch ctr.State.Status {
|
switch ctr.State.Status {
|
||||||
case "stopped":
|
case oci.ContainerStateStopped:
|
||||||
status = "Exited (" + strconv.FormatInt(int64(ctr.State.ExitCode), 10) + ") " + runningFor + " ago"
|
status = "Exited (" + strconv.FormatInt(int64(ctr.State.ExitCode), 10) + ") " + runningFor + " ago"
|
||||||
case runningState:
|
case oci.ContainerStateRunning:
|
||||||
status = "Up " + runningFor + " ago"
|
status = "Up " + runningFor + " ago"
|
||||||
|
case oci.ContainerStatePaused:
|
||||||
|
status = "Paused"
|
||||||
default:
|
default:
|
||||||
status = "Created"
|
status = "Created"
|
||||||
}
|
}
|
||||||
|
@ -385,7 +385,7 @@ func getJSONOutput(containers []*libkpod.ContainerData, nSpace bool) (psOutput [
|
||||||
Names: ctr.Name,
|
Names: ctr.Name,
|
||||||
Labels: ctr.Labels,
|
Labels: ctr.Labels,
|
||||||
Mounts: ctr.Mounts,
|
Mounts: ctr.Mounts,
|
||||||
ContainerRunning: ctr.State.Status == runningState,
|
ContainerRunning: ctr.State.Status == oci.ContainerStateRunning,
|
||||||
Namespaces: ns,
|
Namespaces: ns,
|
||||||
}
|
}
|
||||||
psOutput = append(psOutput, params)
|
psOutput = append(psOutput, params)
|
||||||
|
|
|
@ -79,6 +79,9 @@ Display the logs of a container
|
||||||
### mount
|
### mount
|
||||||
Mount a working container's root filesystem
|
Mount a working container's root filesystem
|
||||||
|
|
||||||
|
### pause
|
||||||
|
Pause one or more containers
|
||||||
|
|
||||||
### ps
|
### ps
|
||||||
Prints out information about containers
|
Prints out information about containers
|
||||||
|
|
||||||
|
@ -106,6 +109,9 @@ Display a live stream of one or more containers' resource usage statistics
|
||||||
### stop
|
### stop
|
||||||
Stops one or more running containers.
|
Stops one or more running containers.
|
||||||
|
|
||||||
|
### unpause
|
||||||
|
Unpause one or more containers
|
||||||
|
|
||||||
### tag
|
### tag
|
||||||
Add an additional name to a local image
|
Add an additional name to a local image
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue