summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel J Walsh <dwalsh@redhat.com>2018-05-04 14:25:17 -0400
committerAtomic Bot <atomic-devel@projectatomic.io>2018-05-04 20:09:17 +0000
commitbb0e7540dcdcd77747418658058767c2705ad0a0 (patch)
treed8c259291a78b0f64f0905375d5d8a232e3d2490
parent9cb694e094f10fc9191dda707a92893c1fbd1761 (diff)
downloadpodman-bb0e7540dcdcd77747418658058767c2705ad0a0.tar.gz
podman-bb0e7540dcdcd77747418658058767c2705ad0a0.tar.bz2
podman-bb0e7540dcdcd77747418658058767c2705ad0a0.zip
Should not error out if container no longer exists in oci
This prevents you from cleaning up the container database, if some how runc and friends db gets screwed up. Signed-off-by: Daniel J Walsh <dwalsh@redhat.com> Closes: #725 Approved by: mheon
-rw-r--r--libpod/oci.go10
1 files changed, 7 insertions, 3 deletions
diff --git a/libpod/oci.go b/libpod/oci.go
index 9c842f2c9..a07aa8d86 100644
--- a/libpod/oci.go
+++ b/libpod/oci.go
@@ -10,6 +10,7 @@ import (
"path/filepath"
"runtime"
"strconv"
+ "strings"
"sync"
"syscall"
"time"
@@ -399,15 +400,18 @@ func (r *OCIRuntime) updateContainerStatus(ctr *Container) error {
// Store old state so we know if we were already stopped
oldState := ctr.state.State
- out, err := exec.Command(r.path, "state", ctr.ID()).Output()
+ out, err := exec.Command(r.path, "state", ctr.ID()).CombinedOutput()
if err != nil {
+ if strings.HasSuffix(string(out), "does not exist") {
+ ctr.removeConmonFiles()
+ ctr.state.State = ContainerStateConfigured
+ return nil
+ }
return errors.Wrapf(err, "error getting container %s state. stderr/out: %s", ctr.ID(), out)
}
-
if err := json.NewDecoder(bytes.NewBuffer(out)).Decode(state); err != nil {
return errors.Wrapf(err, "error decoding container status for container %s", ctr.ID())
}
-
ctr.state.PID = state.Pid
switch state.Status {