mirror of https://github.com/containers/podman.git
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
This commit is contained in:
parent
76915d5ffd
commit
33f95b9ef8
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue