Skip to content

Commit

Permalink
Pullthrough logging improvements
Browse files Browse the repository at this point in the history
Signed-off-by: Michal Minář <miminar@redhat.com>
  • Loading branch information
Michal Minář committed Aug 5, 2016
1 parent ddbf11f commit c4746e7
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions pkg/dockerregistry/server/pullthroughblobstore.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func (r *pullthroughBlobStore) Stat(ctx context.Context, dgst digest.Digest) (di
// continue on to the code below and look up the blob in a remote store since it is not in
// the local store
case err != nil:
context.GetLogger(r.repo.ctx).Errorf("Failed to find blob %q: %#v", dgst.String(), err)
context.GetLogger(ctx).Errorf("Failed to find blob %q: %#v", dgst.String(), err)
fallthrough
default:
return desc, err
Expand All @@ -50,7 +50,7 @@ func (r *pullthroughBlobStore) Stat(ctx context.Context, dgst digest.Digest) (di
if errors.IsNotFound(err) || errors.IsForbidden(err) {
return distribution.Descriptor{}, distribution.ErrBlobUnknown
}
context.GetLogger(r.repo.ctx).Errorf("Error retrieving image stream for blob: %s", err)
context.GetLogger(ctx).Errorf("Error retrieving image stream for blob: %v", err)
return distribution.Descriptor{}, err
}

Expand Down Expand Up @@ -84,17 +84,17 @@ func (r *pullthroughBlobStore) Stat(ctx context.Context, dgst digest.Digest) (di
// proxyStat attempts to locate the digest in the provided remote repository or returns an error. If the digest is found,
// r.digestToStore saves the store.
func (r *pullthroughBlobStore) proxyStat(ctx context.Context, retriever importer.RepositoryRetriever, ref imageapi.DockerImageReference, dgst digest.Digest) (distribution.Descriptor, error) {
context.GetLogger(r.repo.ctx).Infof("Trying to stat %q from %q", dgst, ref.Exact())
context.GetLogger(ctx).Infof("Trying to stat %q from %q", dgst, ref.Exact())
repo, err := retriever.Repository(ctx, ref.RegistryURL(), ref.RepositoryName(), r.pullFromInsecureRegistries)
if err != nil {
context.GetLogger(r.repo.ctx).Errorf("Error getting remote repository for image %q: %v", ref.Exact(), err)
context.GetLogger(ctx).Errorf("Error getting remote repository for image %q: %v", ref.Exact(), err)
return distribution.Descriptor{}, err
}
pullthroughBlobStore := repo.Blobs(ctx)
desc, err := pullthroughBlobStore.Stat(ctx, dgst)
if err != nil {
if err != distribution.ErrBlobUnknown {
context.GetLogger(r.repo.ctx).Errorf("Error getting pullthroughBlobStore for image %q: %v", ref.Exact(), err)
context.GetLogger(ctx).Errorf("Error getting pullthroughBlobStore for image %q: %v", ref.Exact(), err)
}
return distribution.Descriptor{}, err
}
Expand All @@ -112,13 +112,13 @@ func (r *pullthroughBlobStore) ServeBlob(ctx context.Context, w http.ResponseWri

desc, err := store.Stat(ctx, dgst)
if err != nil {
context.GetLogger(r.repo.ctx).Errorf("Failed to stat digest %q: %v", dgst.String(), err)
context.GetLogger(ctx).Errorf("Failed to stat digest %q: %v", dgst.String(), err)
return err
}

remoteReader, err := store.Open(ctx, dgst)
if err != nil {
context.GetLogger(r.repo.ctx).Errorf("Failure to open remote store %q: %v", dgst.String(), err)
context.GetLogger(ctx).Errorf("Failure to open remote store for digest %q: %v", dgst.String(), err)
return err
}

Expand Down Expand Up @@ -151,7 +151,7 @@ func (r *pullthroughBlobStore) findCandidateRepository(ctx context.Context, sear
delete(search, repo)
continue
}
context.GetLogger(r.repo.ctx).Infof("Found digest location from cache %q in %q: %v", dgst, repo, err)
context.GetLogger(ctx).Infof("Found digest location from cache %q in %q", dgst, repo)
return desc, nil
}

Expand All @@ -162,7 +162,7 @@ func (r *pullthroughBlobStore) findCandidateRepository(ctx context.Context, sear
continue
}
r.repo.cachedLayers.RememberDigest(dgst, repo)
context.GetLogger(r.repo.ctx).Infof("Found digest location by search %q in %q: %v", dgst, repo, err)
context.GetLogger(ctx).Infof("Found digest location by search %q in %q", dgst, repo)
return desc, nil
}

Expand Down

0 comments on commit c4746e7

Please sign in to comment.