mirror of
https://github.com/clearlinux/docker.git
synced 2026-09-04 20:51:44 +00:00
Make the v2 logic fallback on v1 when v2 requests cannot be authorized.
Signed-off-by: Matt Moore <mattmoor@google.com>
This commit is contained in:
@@ -482,6 +482,10 @@ func (s *TagStore) pullV2Repository(r *registry.Session, out io.Writer, repoInfo
|
||||
if err != nil {
|
||||
return fmt.Errorf("error getting authorization: %s", err)
|
||||
}
|
||||
if !auth.CanAuthorizeV2() {
|
||||
return ErrV2RegistryUnavailable
|
||||
}
|
||||
|
||||
var layersDownloaded bool
|
||||
if tag == "" {
|
||||
logrus.Debugf("Pulling tag list from V2 registry for %s", repoInfo.CanonicalName)
|
||||
|
||||
@@ -322,6 +322,9 @@ func (s *TagStore) pushV2Repository(r *registry.Session, localRepo Repository, o
|
||||
if err != nil {
|
||||
return fmt.Errorf("error getting authorization: %s", err)
|
||||
}
|
||||
if !auth.CanAuthorizeV2() {
|
||||
return ErrV2RegistryUnavailable
|
||||
}
|
||||
|
||||
for _, tag := range tags {
|
||||
logrus.Debugf("Pushing repository: %s:%s", repoInfo.CanonicalName, tag)
|
||||
@@ -549,6 +552,7 @@ func (s *TagStore) Push(localName string, imagePushConfig *ImagePushConfig) erro
|
||||
if err != ErrV2RegistryUnavailable {
|
||||
return fmt.Errorf("Error pushing to registry: %s", err)
|
||||
}
|
||||
logrus.Debug("V2 registry is unavailable, falling back on V1")
|
||||
}
|
||||
|
||||
if err := s.pushRepository(r, imagePushConfig.OutStream, repoInfo, localRepo, imagePushConfig.Tag, sf); err != nil {
|
||||
|
||||
Reference in New Issue
Block a user