mirror of
https://github.com/moby/moby.git
synced 2026-01-11 18:51:37 +00:00
daemon/containerd: ImageService.resolveImage: cleanup resolve by name:tag
- scope variables locally to the if/else if - use if/else if to try to make it more clear it's a "best effort" before falling through to other ways of resolving the image reference - remove outdated TODO, now that containerd errdefs can be used for either moby, or containerd error definitions. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
@@ -166,15 +166,12 @@ func (i *ImageService) resolveImage(ctx context.Context, refOrID string) (c8dima
|
||||
return imgs[0], nil
|
||||
}
|
||||
|
||||
// Try resolve by name:tag
|
||||
ref := reference.TagNameOnly(parsed.(reference.Named)).String()
|
||||
img, err := i.images.Get(ctx, ref)
|
||||
if err == nil {
|
||||
if img, err := i.images.Get(ctx, ref); err == nil {
|
||||
return img, nil
|
||||
} else {
|
||||
// TODO(containerd): error translation can use common function
|
||||
if !cerrdefs.IsNotFound(err) {
|
||||
return c8dimages.Image{}, err
|
||||
}
|
||||
} else if !cerrdefs.IsNotFound(err) {
|
||||
return c8dimages.Image{}, err
|
||||
}
|
||||
|
||||
// If the identifier could be a short ID, attempt to match.
|
||||
|
||||
Reference in New Issue
Block a user