Avoid returning nil, nil when fetching a manifest by tag by introducing a new

error ErrManifestNotModified which can be checked by clients.

Signed-off-by: Richard Scothern <richard.scothern@gmail.com>
This commit is contained in:
Richard Scothern
2015-09-18 11:00:44 -07:00
parent ece8e132bf
commit 924913b4c3
4 changed files with 11 additions and 9 deletions

View File

@@ -102,11 +102,11 @@ func (pms proxyManifestStore) GetByTag(tag string, options ...distribution.Manif
fromremote:
var sm *schema1.SignedManifest
sm, err = pms.remoteManifests.GetByTag(tag, client.AddEtagToTag(tag, localDigest.String()))
if err != nil {
if err != nil && err != distribution.ErrManifestNotModified {
return nil, err
}
if sm == nil {
if err == distribution.ErrManifestNotModified {
context.GetLogger(pms.ctx).Debugf("Local manifest for %q is latest, dgst=%s", tag, localDigest.String())
return localManifest, nil
}