Skip to content

Commit

Permalink
Merge pull request #8151 from vrothberg/fix-8148
Browse files Browse the repository at this point in the history
image list: check for all errors
  • Loading branch information
openshift-merge-robot authored Oct 27, 2020
2 parents 5c08495 + 65fabcf commit 0f0d857
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions pkg/domain/infra/abi/images_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 0f0d857

Please sign in to comment.