1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Remove the lookup before pushing

This commit is contained in:
Guillaume J. Charmes 2013-03-22 13:10:17 -07:00
parent b809dc4271
commit 89763bc8af
2 changed files with 9 additions and 4 deletions

View file

@ -425,15 +425,19 @@ func (srv *Server) CmdPush(stdin io.ReadCloser, stdout io.Writer, args ...string
remote = local
}
Debugf("Pushing [%s] to [%s]\n", local, remote)
// Try to get the image
// FIXME: Handle lookup
// FIXME: Also push the tags in case of ./docker push myrepo:mytag
// img, err := srv.runtime.LookupImage(cmd.Arg(0))
img, err := srv.runtime.graph.Get(local)
if err != nil {
Debugf("The push refers to a repository [%s] (len: %d)\n", local, len(srv.runtime.repositories.Repositories[local]))
// If it fails, try to get the repository
if localRepo, exists := srv.runtime.repositories.Repositories[local]; exists {
fmt.Fprintf(stdout, "Pushing %s (%d images) on %s...\n", local, len(localRepo), remote)
fmt.Fprintf(stdout, "Pushing %s (%d tags) on %s...\n", local, len(localRepo), remote)
if err := srv.runtime.graph.PushRepository(remote, localRepo, srv.runtime.authConfig); err != nil {
return err
}

View file

@ -370,9 +370,10 @@ func (graph *Graph) pushPrimitive(remote, tag, imgId string, authConfig *auth.Au
// Remote has the format '<user>/<repo>
func (graph *Graph) PushRepository(remote string, localRepo Repository, authConfig *auth.AuthConfig) error {
// Check if the remote repository exists
if !graph.LookupRemoteRepository(remote, authConfig) {
return fmt.Errorf("The remote repository %s does not exist\n", remote)
}
// FIXME: @lopter How to handle this?
// if !graph.LookupRemoteRepository(remote, authConfig) {
// return fmt.Errorf("The remote repository %s does not exist\n", remote)
// }
// For each image within the repo, push them
for tag, imgId := range localRepo {