summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-10-27 14:29:41 +0100
committerGitHub <noreply@github.com>2020-10-27 14:29:41 +0100
commit0f0d857f6cc77d4bac7ea657c5d53feec0337a63 (patch)
treec5cf8320f4fb0b95927dead4f14a7dd816b4b660
parent5c0849534d7bed20ec588d8ec0099a8b60df7e25 (diff)
parent65fabcfce7b4ed04b50bb4e387ef8b11e509ecf8 (diff)
downloadpodman-0f0d857f6cc77d4bac7ea657c5d53feec0337a63.tar.gz
podman-0f0d857f6cc77d4bac7ea657c5d53feec0337a63.tar.bz2
podman-0f0d857f6cc77d4bac7ea657c5d53feec0337a63.zip
Merge pull request #8151 from vrothberg/fix-8148
image list: check for all errors
-rw-r--r--pkg/domain/infra/abi/images_list.go16
1 files changed, 13 insertions, 3 deletions
diff --git a/pkg/domain/infra/abi/images_list.go b/pkg/domain/infra/abi/images_list.go
index 3e47dc67a..281b04294 100644
--- a/pkg/domain/infra/abi/images_list.go
+++ b/pkg/domain/infra/abi/images_list.go
@@ -5,6 +5,7 @@ import (
libpodImage "github.com/containers/podman/v2/libpod/image"
"github.com/containers/podman/v2/pkg/domain/entities"
+ "github.com/pkg/errors"
)
func (ir *ImageEngine) List(ctx context.Context, opts entities.ImageListOptions) ([]*entities.ImageSummary, error) {
@@ -43,12 +44,21 @@ func (ir *ImageEngine) List(ctx context.Context, opts entities.ImageListOptions)
VirtualSize: img.VirtualSize,
RepoTags: img.Names(), // may include tags and digests
}
- e.Labels, _ = img.Labels(context.TODO())
+ e.Labels, err = img.Labels(ctx)
+ if err != nil {
+ return nil, errors.Wrapf(err, "error retrieving label for image %q: you may need to remove the image to resolve the error", img.ID())
+ }
- ctnrs, _ := img.Containers()
+ ctnrs, err := img.Containers()
+ if err != nil {
+ return nil, errors.Wrapf(err, "error retrieving containers for image %q: you may need to remove the image to resolve the error", img.ID())
+ }
e.Containers = len(ctnrs)
- sz, _ := img.Size(context.TODO())
+ sz, err := img.Size(ctx)
+ if err != nil {
+ return nil, errors.Wrapf(err, "error retrieving size of image %q: you may need to remove the image to resolve the error", img.ID())
+ }
e.Size = int64(*sz)
summaries = append(summaries, &e)