From 9b36527ddd08a0aa819610ebafd3612da83c5b14 Mon Sep 17 00:00:00 2001 From: Wenkai Yin Date: Thu, 8 Feb 2018 17:28:22 +0800 Subject: [PATCH] ignore path not found error when look up tags Signed-off-by: Wenkai Yin (cherry picked from commit 005c6e0236c98544d35197a17947c02e23bc9223) --- registry/storage/tagstore.go | 4 ++++ registry/storage/tagstore_test.go | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/registry/storage/tagstore.go b/registry/storage/tagstore.go index 96eb1c8d..be7baf87 100644 --- a/registry/storage/tagstore.go +++ b/registry/storage/tagstore.go @@ -182,6 +182,10 @@ func (ts *tagStore) Lookup(ctx context.Context, desc distribution.Descriptor) ([ tagLinkPath, err := pathFor(tagLinkPathSpec) tagDigest, err := ts.blobStore.readlink(ctx, tagLinkPath) if err != nil { + switch err.(type) { + case storagedriver.PathNotFoundError: + continue + } return nil, err } diff --git a/registry/storage/tagstore_test.go b/registry/storage/tagstore_test.go index 554a46bf..0c8e3611 100644 --- a/registry/storage/tagstore_test.go +++ b/registry/storage/tagstore_test.go @@ -84,8 +84,8 @@ func TestTagStoreUnTag(t *testing.T) { desc := distribution.Descriptor{Digest: "sha256:bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"} err := tags.Untag(ctx, "latest") - if err == nil { - t.Errorf("Expected error untagging non-existant tag") + if err != nil { + t.Error(err) } err = tags.Tag(ctx, "latest", desc)