Quellcode durchsuchen

daemon/list: Replace ErrImageDoesNotExist check

Check for generic `errdefs.NotFound` rather than specific error helper
struct when checking if the error is caused by the image not being
present.
It still works for `ErrImageDoesNotExist` because it
implements the NotFound errdefs interface too.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
Paweł Gronowski vor 2 Jahren
Ursprung
Commit
5a39bee635
1 geänderte Dateien mit 1 neuen und 2 gelöschten Zeilen
  1. 1 2
      daemon/list.go

+ 1 - 2
daemon/list.go

@@ -12,7 +12,6 @@ import (
 	"github.com/docker/docker/api/types/filters"
 	imagetypes "github.com/docker/docker/api/types/image"
 	"github.com/docker/docker/container"
-	"github.com/docker/docker/daemon/images"
 	"github.com/docker/docker/errdefs"
 	"github.com/docker/docker/image"
 	"github.com/docker/go-connections/nat"
@@ -584,7 +583,7 @@ func (daemon *Daemon) refreshImage(ctx context.Context, s *container.Snapshot, f
 	tmpImage := s.Image // keep the original ref if still valid (hasn't changed)
 	if tmpImage != s.ImageID {
 		img, err := daemon.imageService.GetImage(ctx, tmpImage, imagetypes.GetImageOpts{})
-		if _, isDNE := err.(images.ErrImageDoesNotExist); err != nil && !isDNE {
+		if err != nil && !errdefs.IsNotFound(err) {
 			return nil, err
 		}
 		if err != nil || img.ImageID() != s.ImageID {