Correctly report errors retrieving containers in ps

Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #944
Approved by: rhatdan
This commit is contained in:
Matthew Heon 2018-06-14 12:41:38 -04:00 committed by Atomic Bot
parent 8d5da78b0e
commit cdb447bba2
2 changed files with 7 additions and 2 deletions

View File

@ -200,6 +200,12 @@ func psCmd(c *cli.Context) error {
}
containers, err := runtime.GetContainers(filterFuncs...)
if err != nil {
return err
}
// TODO: Latest and Last are broken right now due to lack of container
// ordering
var outputContainers []*libpod.Container
if opts.Latest && len(containers) > 0 {
outputContainers = append(outputContainers, containers[0])

View File

@ -620,7 +620,7 @@ func (s *BoltState) AllContainers() ([]*Container, error) {
return err
}
err = allCtrsBucket.ForEach(func(id, name []byte) error {
return allCtrsBucket.ForEach(func(id, name []byte) error {
// If performance becomes an issue, this check can be
// removed. But the error messages that come back will
// be much less helpful.
@ -637,7 +637,6 @@ func (s *BoltState) AllContainers() ([]*Container, error) {
return s.getContainerFromDB(id, ctr, ctrBucket)
})
return err
})
if err != nil {
return nil, err