Browse Source

Remove the possibility to choose the remote name on push

creack 12 years ago
parent
commit
c000a5ed75
2 changed files with 8 additions and 13 deletions
  1. 7 13
      commands.go
  2. 1 0
      registry.go

+ 7 - 13
commands.go

@@ -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 {
 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 {
 	if err := cmd.Parse(args); err != nil {
 		return nil
 		return nil
 	}
 	}
 	local := cmd.Arg(0)
 	local := cmd.Arg(0)
-	remote := cmd.Arg(1)
 
 
 	if local == "" {
 	if local == "" {
 		cmd.Usage()
 		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')")
 		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 {
 	} 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
 	// Try to get the image

+ 1 - 0
registry.go

@@ -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",
 					"Error: Internal server error trying to push image {%s} (json): %s",
 					img.Id, err)
 					img.Id, err)
 			}
 			}
+			fmt.Printf("Pushing return status: %d\n", res.StatusCode)
 			switch res.StatusCode {
 			switch res.StatusCode {
 			case 204:
 			case 204:
 				// Case where the image is already on the Registry
 				// Case where the image is already on the Registry