summaryrefslogtreecommitdiff
path: root/cmd/podman
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2018-10-03 06:06:14 -0700
committerGitHub <noreply@github.com>2018-10-03 06:06:14 -0700
commita3c4ce6717cab56d968fbe1fff0ced19f45c23cb (patch)
tree41657a47b6edeb8ab4776eddf64cb76f59b2813c /cmd/podman
parentd5687946f6a0aa14a5326f26ca0ceca68588056f (diff)
parent978aac665060140f08a5574e3611a17cc98516c0 (diff)
downloadpodman-a3c4ce6717cab56d968fbe1fff0ced19f45c23cb.tar.gz
podman-a3c4ce6717cab56d968fbe1fff0ced19f45c23cb.tar.bz2
podman-a3c4ce6717cab56d968fbe1fff0ced19f45c23cb.zip
Merge pull request #1531 from mheon/add_exited_state
Add ContainerStateExited and OCI delete() in cleanup()
Diffstat (limited to 'cmd/podman')
-rw-r--r--cmd/podman/cleanup.go4
-rw-r--r--cmd/podman/pod_stop.go4
-rw-r--r--cmd/podman/ps.go2
-rw-r--r--cmd/podman/run.go2
-rw-r--r--cmd/podman/start.go7
5 files changed, 14 insertions, 5 deletions
diff --git a/cmd/podman/cleanup.go b/cmd/podman/cleanup.go
index 6ebb682ed..316704f91 100644
--- a/cmd/podman/cleanup.go
+++ b/cmd/podman/cleanup.go
@@ -46,6 +46,8 @@ func cleanupCmd(c *cli.Context) error {
args := c.Args()
+ ctx := getContext()
+
var lastError error
var cleanupContainers []*libpod.Container
if c.Bool("all") {
@@ -80,7 +82,7 @@ func cleanupCmd(c *cli.Context) error {
}
}
for _, ctr := range cleanupContainers {
- if err = ctr.Cleanup(); err != nil {
+ if err = ctr.Cleanup(ctx); err != nil {
if lastError != nil {
fmt.Fprintln(os.Stderr, lastError)
}
diff --git a/cmd/podman/pod_stop.go b/cmd/podman/pod_stop.go
index 03d04a3ec..6dc6a2b2d 100644
--- a/cmd/podman/pod_stop.go
+++ b/cmd/podman/pod_stop.go
@@ -50,9 +50,11 @@ func podStopCmd(c *cli.Context) error {
// in which case the following loop will be skipped.
pods, lastError := getPodsFromContext(c, runtime)
+ ctx := getContext()
+
for _, pod := range pods {
// set cleanup to true to clean mounts and namespaces
- ctr_errs, err := pod.Stop(true)
+ ctr_errs, err := pod.Stop(ctx, true)
if ctr_errs != nil {
for ctr, err := range ctr_errs {
if lastError != nil {
diff --git a/cmd/podman/ps.go b/cmd/podman/ps.go
index d36c929e8..e53afe1bf 100644
--- a/cmd/podman/ps.go
+++ b/cmd/podman/ps.go
@@ -548,6 +548,8 @@ func getTemplateOutput(psParams []psJSONParams, opts shared.PsOptions) ([]psTemp
labels := formatLabels(psParam.Labels)
switch psParam.Status {
+ case libpod.ContainerStateExited.String():
+ fallthrough
case libpod.ContainerStateStopped.String():
exitedSince := units.HumanDuration(time.Since(psParam.ExitedAt))
status = fmt.Sprintf("Exited (%d) %s ago", psParam.ExitCode, exitedSince)
diff --git a/cmd/podman/run.go b/cmd/podman/run.go
index f9a96e4a6..fbad4237d 100644
--- a/cmd/podman/run.go
+++ b/cmd/podman/run.go
@@ -140,7 +140,7 @@ func runCmd(c *cli.Context) error {
return runtime.RemoveContainer(ctx, ctr, true)
}
- if err := ctr.Cleanup(); err != nil {
+ if err := ctr.Cleanup(ctx); err != nil {
// If the container has been removed already, no need to error on cleanup
// Also, if it was restarted, don't error either
if errors.Cause(err) == libpod.ErrNoSuchCtr ||
diff --git a/cmd/podman/start.go b/cmd/podman/start.go
index cb65ec6d4..a34f6df5d 100644
--- a/cmd/podman/start.go
+++ b/cmd/podman/start.go
@@ -81,6 +81,9 @@ func startCmd(c *cli.Context) error {
}
args = append(args, lastCtr.ID())
}
+
+ ctx := getContext()
+
var lastError error
for _, container := range args {
ctr, err := runtime.LookupContainer(container)
@@ -121,14 +124,14 @@ func startCmd(c *cli.Context) error {
exitCode = int(ecode)
}
- return ctr.Cleanup()
+ return ctr.Cleanup(ctx)
}
if ctrRunning {
fmt.Println(ctr.ID())
continue
}
// Handle non-attach start
- if err := ctr.Start(getContext()); err != nil {
+ if err := ctr.Start(ctx); err != nil {
if lastError != nil {
fmt.Fprintln(os.Stderr, lastError)
}