Browse code

Limit push and pull to v2 official registry

No longer push to the official v2 registry when it is available. This allows pulling images from the v2 registry without defaulting push. Only pull official images from the v2 official registry.

Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)

Derek McGowan authored on 2015/02/05 02:21:36
Showing 2 changed files
... ...
@@ -72,7 +72,7 @@ func (s *TagStore) CmdPull(job *engine.Job) engine.Status {
72 72
 		logName += ":" + tag
73 73
 	}
74 74
 
75
-	if len(repoInfo.Index.Mirrors) == 0 && (repoInfo.Index.Official || endpoint.Version == registry.APIVersion2) {
75
+	if len(repoInfo.Index.Mirrors) == 0 && ((repoInfo.Official && repoInfo.Index.Official) || endpoint.Version == registry.APIVersion2) {
76 76
 		j := job.Eng.Job("trust_update_base")
77 77
 		if err = j.Run(); err != nil {
78 78
 			log.Errorf("error updating trust base graph: %s", err)
... ...
@@ -455,7 +455,7 @@ func (s *TagStore) CmdPush(job *engine.Job) engine.Status {
455 455
 		return job.Error(err2)
456 456
 	}
457 457
 
458
-	if repoInfo.Index.Official || endpoint.Version == registry.APIVersion2 {
458
+	if endpoint.Version == registry.APIVersion2 {
459 459
 		err := s.pushV2Repository(r, job.Eng, job.Stdout, repoInfo, tag, sf)
460 460
 		if err == nil {
461 461
 			return engine.StatusOK