From 7c2a47f8b9119bb47c344d09f9f97b138e2593f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miloslav=20Trma=C4=8D?= Date: Thu, 1 Sep 2016 22:17:04 +0200 Subject: [PATCH] Vendor after merging mtrmac/image:remove-signatures --- vendor/github.com/containers/image/copy/copy.go | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/vendor/github.com/containers/image/copy/copy.go b/vendor/github.com/containers/image/copy/copy.go index 79fd3b18..712eaae7 100644 --- a/vendor/github.com/containers/image/copy/copy.go +++ b/vendor/github.com/containers/image/copy/copy.go @@ -76,7 +76,8 @@ func (d *digestingReader) Read(p []byte) (int, error) { // Options allows supplying non-default configuration modifying the behavior of CopyImage. type Options struct { - SignBy string // If non-empty, asks for a signature to be added during the copy, and specifies a key ID, as accepted by signature.NewGPGSigningMechanism().SignDockerManifest(), + RemoveSignatures bool // Remove any pre-existing signatures. SignBy will still add a new signature. + SignBy string // If non-empty, asks for a signature to be added during the copy, and specifies a key ID, as accepted by signature.NewGPGSigningMechanism().SignDockerManifest(), } // Image copies image from srcRef to destRef, using policyContext to validate source image admissibility. @@ -101,9 +102,16 @@ func Image(ctx *types.SystemContext, policyContext *signature.PolicyContext, des return fmt.Errorf("Error reading manifest: %v", err) } - sigs, err := src.Signatures() - if err != nil { - return fmt.Errorf("Error reading signatures: %v", err) + var sigs [][]byte + if options != nil && options.RemoveSignatures { + sigs = [][]byte{} + } else { + s, err := src.Signatures() + if err != nil { + return fmt.Errorf("Error reading signatures: %v", err) + } + sigs = s + // FIXME: Fail early if we can detect that RemoveSignatures should be used. } blobDigests, err := src.BlobDigests()