Remove the possibility to choose the remote name on push

Upstream-commit: c000a5ed75f8b238fd7d908118eea9d9e740f66d
Component: engine
This commit is contained in:
creack
2013-03-22 07:10:52 -07:00
parent 3c25a6e83f
commit 6eb0531b54
2 changed files with 8 additions and 13 deletions
+7 -13
View File
@@ -402,12 +402,11 @@ func (srv *Server) CmdImport(stdin io.ReadCloser, stdout io.Writer, args ...stri
}
func (srv *Server) CmdPush(stdin io.ReadCloser, stdout io.Writer, args ...string) error {
cmd := rcli.Subcmd(stdout, "push", "LOCAL [REMOTE]", "Push an image or a repository to the registry")
cmd := rcli.Subcmd(stdout, "push", "LOCAL", "Push an image or a repository to the registry")
if err := cmd.Parse(args); err != nil {
return nil
}
local := cmd.Arg(0)
remote := cmd.Arg(1)
if local == "" {
cmd.Usage()
@@ -419,18 +418,13 @@ func (srv *Server) CmdPush(stdin io.ReadCloser, stdout io.Writer, args ...string
return fmt.Errorf("Please login prior to push. ('docker login')")
}
if remote == "" {
tmp := strings.SplitN(local, "/", 2)
if len(tmp) == 1 {
remote = srv.runtime.authConfig.Username + "/" + local
} else {
remote = local
}
var remote string
tmp := strings.SplitN(local, "/", 2)
if len(tmp) == 1 {
remote = srv.runtime.authConfig.Username + "/" + local
} else {
tmp := strings.SplitN(remote, "/", 2)
if len(tmp) == 1 {
return fmt.Errorf("The remote repository needs to be in the <user>/<repo> format")
}
remote = local
}
// Try to get the image
+1
View File
@@ -221,6 +221,7 @@ func (graph *Graph) PushImage(imgOrig *Image, authConfig *auth.AuthConfig) error
"Error: Internal server error trying to push image {%s} (json): %s",
img.Id, err)
}
fmt.Printf("Pushing return status: %d\n", res.StatusCode)
switch res.StatusCode {
case 204:
// Case where the image is already on the Registry