mirror of
https://github.com/containers/podman.git
synced 2025-05-21 17:16:22 +08:00
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:
@ -705,7 +705,11 @@ func (s *BoltState) AllContainers() ([]*Container, error) {
|
|||||||
// We just won't include the container in the
|
// We just won't include the container in the
|
||||||
// results.
|
// results.
|
||||||
if errors.Cause(err) != ErrNSMismatch {
|
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 {
|
} else {
|
||||||
ctrs = append(ctrs, ctr)
|
ctrs = append(ctrs, ctr)
|
||||||
@ -1655,7 +1659,7 @@ func (s *BoltState) AllPods() ([]*Pod, error) {
|
|||||||
|
|
||||||
if err := s.getPodFromDB(id, pod, podBucket); err != nil {
|
if err := s.getPodFromDB(id, pod, podBucket); err != nil {
|
||||||
if errors.Cause(err) != ErrNSMismatch {
|
if errors.Cause(err) != ErrNSMismatch {
|
||||||
return err
|
logrus.Errorf("Error retrieving pod %s from the database: %v", string(id), err)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
pods = append(pods, pod)
|
pods = append(pods, pod)
|
||||||
|
Reference in New Issue
Block a user