From ad7ab0853cca5599ddf7f06bbdd76b823d23cf63 Mon Sep 17 00:00:00 2001 From: Mike Brown Date: Thu, 31 Aug 2017 21:14:40 -0500 Subject: [PATCH] folow commit 9c88801a12a97de49abf26e9604975eececa654c Signed-off-by: Mike Brown --- manifest/ocischema/builder.go | 3 ++- manifest/ocischema/builder_test.go | 2 +- registry/handlers/manifests.go | 10 +++++----- registry/storage/ocimanifesthandler.go | 9 +++++---- registry/storage/ocimanifesthandler_test.go | 2 +- 5 files changed, 14 insertions(+), 12 deletions(-) diff --git a/manifest/ocischema/builder.go b/manifest/ocischema/builder.go index c10376f8..9bfef614 100644 --- a/manifest/ocischema/builder.go +++ b/manifest/ocischema/builder.go @@ -1,8 +1,9 @@ package ocischema import ( + "context" + "github.com/docker/distribution" - "github.com/docker/distribution/context" "github.com/opencontainers/go-digest" "github.com/opencontainers/image-spec/specs-go/v1" ) diff --git a/manifest/ocischema/builder_test.go b/manifest/ocischema/builder_test.go index 557681ba..8e751279 100644 --- a/manifest/ocischema/builder_test.go +++ b/manifest/ocischema/builder_test.go @@ -1,11 +1,11 @@ package ocischema import ( + "context" "reflect" "testing" "github.com/docker/distribution" - "github.com/docker/distribution/context" "github.com/opencontainers/go-digest" "github.com/opencontainers/image-spec/specs-go/v1" ) diff --git a/registry/handlers/manifests.go b/registry/handlers/manifests.go index 53c7c807..8da3f7af 100644 --- a/registry/handlers/manifests.go +++ b/registry/handlers/manifests.go @@ -181,7 +181,7 @@ func (imh *manifestHandler) GetManifest(w http.ResponseWriter, r *http.Request) // matching the digest. if imh.Tag != "" && manifestType == manifestSchema2 && !supports[manifestSchema2] { // Rewrite manifest in schema1 format - ctxu.GetLogger(imh).Infof("rewriting manifest %s in schema1 format to support old client", imh.Digest.String()) + dcontext.GetLogger(imh).Infof("rewriting manifest %s in schema1 format to support old client", imh.Digest.String()) manifest, err = imh.convertSchema2Manifest(schema2Manifest) if err != nil { @@ -189,7 +189,7 @@ func (imh *manifestHandler) GetManifest(w http.ResponseWriter, r *http.Request) } } else if imh.Tag != "" && manifestType == manifestlistSchema && !supports[manifestlistSchema] { // Rewrite manifest in schema1 format - ctxu.GetLogger(imh).Infof("rewriting manifest list %s in schema1 format to support old client", imh.Digest.String()) + dcontext.GetLogger(imh).Infof("rewriting manifest list %s in schema1 format to support old client", imh.Digest.String()) // Find the image manifest corresponding to the default // platform @@ -327,9 +327,9 @@ func (imh *manifestHandler) PutManifest(w http.ResponseWriter, r *http.Request) isAnOCIManifest := mediaType == v1.MediaTypeImageManifest || mediaType == v1.MediaTypeImageIndex if isAnOCIManifest { - ctxu.GetLogger(imh).Debug("Putting an OCI Manifest!") + dcontext.GetLogger(imh).Debug("Putting an OCI Manifest!") } else { - ctxu.GetLogger(imh).Debug("Putting a Docker Manifest!") + dcontext.GetLogger(imh).Debug("Putting a Docker Manifest!") } var options []distribution.ManifestServiceOption @@ -410,7 +410,7 @@ func (imh *manifestHandler) PutManifest(w http.ResponseWriter, r *http.Request) w.Header().Set("Docker-Content-Digest", imh.Digest.String()) w.WriteHeader(http.StatusCreated) - ctxu.GetLogger(imh).Debug("Succeeded in putting manifest!") + dcontext.GetLogger(imh).Debug("Succeeded in putting manifest!") } // applyResourcePolicy checks whether the resource class matches what has diff --git a/registry/storage/ocimanifesthandler.go b/registry/storage/ocimanifesthandler.go index f1fbcead..57ff2829 100644 --- a/registry/storage/ocimanifesthandler.go +++ b/registry/storage/ocimanifesthandler.go @@ -1,12 +1,13 @@ package storage import ( + "context" "encoding/json" "fmt" "net/url" "github.com/docker/distribution" - "github.com/docker/distribution/context" + dcontext "github.com/docker/distribution/context" "github.com/docker/distribution/manifest/ocischema" "github.com/opencontainers/go-digest" "github.com/opencontainers/image-spec/specs-go/v1" @@ -23,7 +24,7 @@ type ocischemaManifestHandler struct { var _ ManifestHandler = &ocischemaManifestHandler{} func (ms *ocischemaManifestHandler) Unmarshal(ctx context.Context, dgst digest.Digest, content []byte) (distribution.Manifest, error) { - context.GetLogger(ms.ctx).Debug("(*ocischemaManifestHandler).Unmarshal") + dcontext.GetLogger(ms.ctx).Debug("(*ocischemaManifestHandler).Unmarshal") var m ocischema.DeserializedManifest if err := json.Unmarshal(content, &m); err != nil { @@ -34,7 +35,7 @@ func (ms *ocischemaManifestHandler) Unmarshal(ctx context.Context, dgst digest.D } func (ms *ocischemaManifestHandler) Put(ctx context.Context, manifest distribution.Manifest, skipDependencyVerification bool) (digest.Digest, error) { - context.GetLogger(ms.ctx).Debug("(*ocischemaManifestHandler).Put") + dcontext.GetLogger(ms.ctx).Debug("(*ocischemaManifestHandler).Put") m, ok := manifest.(*ocischema.DeserializedManifest) if !ok { @@ -52,7 +53,7 @@ func (ms *ocischemaManifestHandler) Put(ctx context.Context, manifest distributi revision, err := ms.blobStore.Put(ctx, mt, payload) if err != nil { - context.GetLogger(ctx).Errorf("error putting payload into blobstore: %v", err) + dcontext.GetLogger(ctx).Errorf("error putting payload into blobstore: %v", err) return "", err } diff --git a/registry/storage/ocimanifesthandler_test.go b/registry/storage/ocimanifesthandler_test.go index 302294af..3983a9f7 100644 --- a/registry/storage/ocimanifesthandler_test.go +++ b/registry/storage/ocimanifesthandler_test.go @@ -1,11 +1,11 @@ package storage import ( + "context" "regexp" "testing" "github.com/docker/distribution" - "github.com/docker/distribution/context" "github.com/docker/distribution/manifest" "github.com/docker/distribution/manifest/ocischema" "github.com/docker/distribution/registry/storage/driver/inmemory"