From 1ba5b3b5538912ba239a376c0c84ea54a062103a Mon Sep 17 00:00:00 2001 From: Stephen J Day Date: Tue, 6 Feb 2018 15:25:51 -0800 Subject: [PATCH] registry/storage: ignore missing tag on delete Signed-off-by: Stephen J Day --- registry/storage/tagstore.go | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/registry/storage/tagstore.go b/registry/storage/tagstore.go index 3fbed6d3..6a5848c7 100644 --- a/registry/storage/tagstore.go +++ b/registry/storage/tagstore.go @@ -122,17 +122,20 @@ func (ts *tagStore) Untag(ctx context.Context, tag string) error { name: ts.repository.Named().Name(), tag: tag, }) - - switch err.(type) { - case storagedriver.PathNotFoundError: - return distribution.ErrTagUnknown{Tag: tag} - case nil: - break - default: + if err != nil { return err } - return ts.blobStore.driver.Delete(ctx, tagPath) + if err := ts.blobStore.driver.Delete(ctx, tagPath); err != nil { + switch err.(type) { + case storagedriver.PathNotFoundError: + return nil // Untag is idempotent, we don't care if it didn't exist + default: + return err + } + } + + return nil } // linkedBlobStore returns the linkedBlobStore for the named tag, allowing one