From 29914e2d04f55e91b78d466b45337527fb624489 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miloslav=20Trma=C4=8D?= Date: Wed, 12 Apr 2017 16:13:26 +0200 Subject: [PATCH] Prefer X-Registry-Supports-Signatures to lookaside MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In general, a single server should never have both, so the order mostly doesn't matter. The one place where the difference is important is the ability of lookside to have a global default; if lookaside is preferred, such a global default makes X-R-S-S impossible to use. The disadvantage of this is that simply upgrading a registry to a server version which supports X-R-S-S breaks any previously configured lookaside for the server. Signed-off-by: Miloslav Trmač --- docker/docker_image_dest.go | 8 ++++---- docker/docker_image_src.go | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/docker/docker_image_dest.go b/docker/docker_image_dest.go index 85d5689952..5f24529beb 100644 --- a/docker/docker_image_dest.go +++ b/docker/docker_image_dest.go @@ -71,10 +71,10 @@ func (d *dockerImageDestination) SupportsSignatures(ctx context.Context) error { return err } switch { - case d.c.signatureBase != nil: - return nil case d.c.supportsSignatures: return nil + case d.c.signatureBase != nil: + return nil default: return errors.Errorf("X-Registry-Supports-Signatures extension not supported, and lookaside is not configured") } @@ -283,10 +283,10 @@ func (d *dockerImageDestination) PutSignatures(ctx context.Context, signatures [ return err } switch { - case d.c.signatureBase != nil: - return d.putSignaturesToLookaside(signatures) case d.c.supportsSignatures: return d.putSignaturesToAPIExtension(ctx, signatures) + case d.c.signatureBase != nil: + return d.putSignaturesToLookaside(signatures) default: return errors.Errorf("X-Registry-Supports-Signatures extension not supported, and lookaside is not configured") } diff --git a/docker/docker_image_src.go b/docker/docker_image_src.go index 98f6067e1e..89fbd62563 100644 --- a/docker/docker_image_src.go +++ b/docker/docker_image_src.go @@ -189,10 +189,10 @@ func (s *dockerImageSource) GetSignatures(ctx context.Context, instanceDigest *d return nil, err } switch { - case s.c.signatureBase != nil: - return s.getSignaturesFromLookaside(ctx, instanceDigest) case s.c.supportsSignatures: return s.getSignaturesFromAPIExtension(ctx, instanceDigest) + case s.c.signatureBase != nil: + return s.getSignaturesFromLookaside(ctx, instanceDigest) default: return [][]byte{}, nil }