From 305ebfda8bc39b39f018d06a554245872b1ff63a Mon Sep 17 00:00:00 2001 From: Antonio Murdaca Date: Tue, 3 May 2016 19:41:19 +0200 Subject: [PATCH] vendor docker/distribution 9ec0d742d69f77caa4dd5f49ceb70c3067d39f30 Signed-off-by: Antonio Murdaca --- hack/vendor.sh | 2 +- .../distribution/manifest/schema1/config_builder.go | 4 +++- .../distribution/registry/api/errcode/register.go | 13 +++++++++++++ .../docker/distribution/registry/client/errors.go | 11 +++++++++-- 4 files changed, 26 insertions(+), 4 deletions(-) diff --git a/hack/vendor.sh b/hack/vendor.sh index 46c4bfb113..80a8aa49ac 100755 --- a/hack/vendor.sh +++ b/hack/vendor.sh @@ -49,7 +49,7 @@ clone git github.com/boltdb/bolt v1.2.0 clone git github.com/miekg/dns 75e6e86cc601825c5dbcd4e0c209eab180997cd7 # get graph and distribution packages -clone git github.com/docker/distribution 467fc068d88aa6610691b7f1a677271a3fac4aac +clone git github.com/docker/distribution 9ec0d742d69f77caa4dd5f49ceb70c3067d39f30 clone git github.com/vbatts/tar-split v0.9.11 # get desired notary commit, might also need to be updated in Dockerfile diff --git a/vendor/src/github.com/docker/distribution/manifest/schema1/config_builder.go b/vendor/src/github.com/docker/distribution/manifest/schema1/config_builder.go index b3d1e55431..5cdd76796c 100644 --- a/vendor/src/github.com/docker/distribution/manifest/schema1/config_builder.go +++ b/vendor/src/github.com/docker/distribution/manifest/schema1/config_builder.go @@ -110,7 +110,8 @@ func (mb *configManifestBuilder) Build(ctx context.Context) (m distribution.Mani ContainerConfig struct { Cmd []string } `json:"container_config,omitempty"` - ThrowAway bool `json:"throwaway,omitempty"` + Author string `json:"author,omitempty"` + ThrowAway bool `json:"throwaway,omitempty"` } fsLayerList := make([]FSLayer, len(img.History)) @@ -145,6 +146,7 @@ func (mb *configManifestBuilder) Build(ctx context.Context) (m distribution.Mani Parent: parent, Comment: h.Comment, Created: h.Created, + Author: h.Author, } v1Compatibility.ContainerConfig.Cmd = []string{img.History[i].CreatedBy} if h.EmptyLayer { diff --git a/vendor/src/github.com/docker/distribution/registry/api/errcode/register.go b/vendor/src/github.com/docker/distribution/registry/api/errcode/register.go index 01c34384b3..7489e84f7d 100644 --- a/vendor/src/github.com/docker/distribution/registry/api/errcode/register.go +++ b/vendor/src/github.com/docker/distribution/registry/api/errcode/register.go @@ -63,6 +63,19 @@ var ( Description: "Returned when a service is not available", HTTPStatusCode: http.StatusServiceUnavailable, }) + + // ErrorCodeTooManyRequests is returned if a client attempts too many + // times to contact a service endpoint. + ErrorCodeTooManyRequests = Register("errcode", ErrorDescriptor{ + Value: "TOOMANYREQUESTS", + Message: "too many requests", + Description: `Returned when a client attempts to contact a + service too many times`, + // FIXME: go1.5 doesn't export http.StatusTooManyRequests while + // go1.6 does. Update the hardcoded value to the constant once + // Docker updates golang version to 1.6. + HTTPStatusCode: 429, + }) ) var nextCode = 1000 diff --git a/vendor/src/github.com/docker/distribution/registry/client/errors.go b/vendor/src/github.com/docker/distribution/registry/client/errors.go index 00fafe117a..adbaacf4bb 100644 --- a/vendor/src/github.com/docker/distribution/registry/client/errors.go +++ b/vendor/src/github.com/docker/distribution/registry/client/errors.go @@ -51,10 +51,17 @@ func parseHTTPErrorResponse(statusCode int, r io.Reader) error { } err = json.Unmarshal(body, &detailsErr) if err == nil && detailsErr.Details != "" { - if statusCode == http.StatusUnauthorized { + switch statusCode { + case http.StatusUnauthorized: return errcode.ErrorCodeUnauthorized.WithMessage(detailsErr.Details) + // FIXME: go1.5 doesn't export http.StatusTooManyRequests while + // go1.6 does. Update the hardcoded value to the constant once + // Docker updates golang version to 1.6. + case 429: + return errcode.ErrorCodeTooManyRequests.WithMessage(detailsErr.Details) + default: + return errcode.ErrorCodeUnknown.WithMessage(detailsErr.Details) } - return errcode.ErrorCodeUnknown.WithMessage(detailsErr.Details) } if err := json.Unmarshal(body, &errors); err != nil {