Skip to content

Commit

Permalink
folow commit 9c88801
Browse files Browse the repository at this point in the history
Signed-off-by: Mike Brown <[email protected]>
  • Loading branch information
mikebrow committed Jun 18, 2018
1 parent 7b47fb1 commit ad7ab08
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 12 deletions.
3 changes: 2 additions & 1 deletion manifest/ocischema/builder.go
Original file line number Diff line number Diff line change
@@ -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"
)
Expand Down
2 changes: 1 addition & 1 deletion manifest/ocischema/builder_test.go
Original file line number Diff line number Diff line change
@@ -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"
)
Expand Down
10 changes: 5 additions & 5 deletions registry/handlers/manifests.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,15 +181,15 @@ 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 {
return
}
} 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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
9 changes: 5 additions & 4 deletions registry/storage/ocimanifesthandler.go
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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 {
Expand All @@ -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 {
Expand All @@ -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
}

Expand Down
2 changes: 1 addition & 1 deletion registry/storage/ocimanifesthandler_test.go
Original file line number Diff line number Diff line change
@@ -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"
Expand Down

0 comments on commit ad7ab08

Please sign in to comment.