diff options
author | Matthew Heon <matthew.heon@gmail.com> | 2018-08-17 14:21:21 -0400 |
---|---|---|
committer | Atomic Bot <atomic-devel@projectatomic.io> | 2018-08-17 19:10:21 +0000 |
commit | 33f95b9ef82e48bd8350f6327292e55004bd6013 (patch) | |
tree | d33b72fee5c59faecceea666eb56df44fa3928b2 | |
parent | 76915d5ffd10a1b9a88bcf44808729ae0d9bc3cf (diff) | |
download | podman-33f95b9ef82e48bd8350f6327292e55004bd6013.tar.gz podman-33f95b9ef82e48bd8350f6327292e55004bd6013.tar.bz2 podman-33f95b9ef82e48bd8350f6327292e55004bd6013.zip |
Make failure to retrieve individual ctrs/pods nonfatal
This ensures that we can still use Podman even if a container or
pod with bad config JSON makes it into the state. We still can't
remove these containers, but at least we can do our best to make
things usable.
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>
Closes: #1294
Approved by: rhatdan
-rw-r--r-- | libpod/boltdb_state.go | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/libpod/boltdb_state.go b/libpod/boltdb_state.go index de6174c10..42f029379 100644 --- a/libpod/boltdb_state.go +++ b/libpod/boltdb_state.go @@ -705,7 +705,11 @@ func (s *BoltState) AllContainers() ([]*Container, error) { // We just won't include the container in the // results. if errors.Cause(err) != ErrNSMismatch { - return err + // Even if it's not an NS mismatch, it's + // not worth erroring over. + // If we do, a single bad container JSON + // could render libpod unusable. + logrus.Errorf("Error retrieving container %s from the database: %v", string(id), err) } } else { ctrs = append(ctrs, ctr) @@ -1655,7 +1659,7 @@ func (s *BoltState) AllPods() ([]*Pod, error) { if err := s.getPodFromDB(id, pod, podBucket); err != nil { if errors.Cause(err) != ErrNSMismatch { - return err + logrus.Errorf("Error retrieving pod %s from the database: %v", string(id), err) } } else { pods = append(pods, pod) |