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 remote = local
} }
Debugf("Pushing [%s] to [%s]\n", local, remote)
// Try to get the image // Try to get the image
// FIXME: Handle lookup // FIXME: Handle lookup
// FIXME: Also push the tags in case of ./docker push myrepo:mytag // FIXME: Also push the tags in case of ./docker push myrepo:mytag
// img, err := srv.runtime.LookupImage(cmd.Arg(0)) // img, err := srv.runtime.LookupImage(cmd.Arg(0))
img, err := srv.runtime.graph.Get(local) img, err := srv.runtime.graph.Get(local)
if err != nil { 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 it fails, try to get the repository
if localRepo, exists := srv.runtime.repositories.Repositories[local]; exists { 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 { if err := srv.runtime.graph.PushRepository(remote, localRepo, srv.runtime.authConfig); err != nil {
return err 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> // Remote has the format '<user>/<repo>
func (graph *Graph) PushRepository(remote string, localRepo Repository, authConfig *auth.AuthConfig) error { func (graph *Graph) PushRepository(remote string, localRepo Repository, authConfig *auth.AuthConfig) error {
// Check if the remote repository exists // Check if the remote repository exists
if !graph.LookupRemoteRepository(remote, authConfig) { // FIXME: @lopter How to handle this?
return fmt.Errorf("The remote repository %s does not exist\n", remote) // 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 each image within the repo, push them
for tag, imgId := range localRepo { for tag, imgId := range localRepo {