Browse code

fix comments and handle err

Signed-off-by: allencloud <allen.sun@daocloud.io>
(cherry picked from commit cc054f3195308da471c252d755dacfe446cb1066)

allencloud authored on 2016/06/29 18:26:42
Showing 5 changed files
... ...
@@ -86,10 +86,10 @@ func (cli *DockerCli) inspectAll(ctx context.Context, getSize bool) inspect.GetR
86 86
 					}
87 87
 					return nil, nil, err
88 88
 				}
89
-				return i, rawImage, err
89
+				return i, rawImage, nil
90 90
 			}
91 91
 			return nil, nil, err
92 92
 		}
93
-		return c, rawContainer, err
93
+		return c, rawContainer, nil
94 94
 	}
95 95
 }
... ...
@@ -57,6 +57,10 @@ func runInstall(dockerCli *client.DockerCli, opts pluginOptions) error {
57 57
 	ctx := context.Background()
58 58
 
59 59
 	repoInfo, err := registry.ParseRepositoryInfo(named)
60
+	if err != nil {
61
+		return err
62
+	}
63
+
60 64
 	authConfig := dockerCli.ResolveAuthConfig(ctx, repoInfo.Index)
61 65
 
62 66
 	encodedAuth, err := client.EncodeAuthToBase64(authConfig)
... ...
@@ -42,6 +42,9 @@ func runPush(dockerCli *client.DockerCli, name string) error {
42 42
 	ctx := context.Background()
43 43
 
44 44
 	repoInfo, err := registry.ParseRepositoryInfo(named)
45
+	if err != nil {
46
+		return err
47
+	}
45 48
 	authConfig := dockerCli.ResolveAuthConfig(ctx, repoInfo.Index)
46 49
 
47 50
 	encodedAuth, err := client.EncodeAuthToBase64(authConfig)
... ...
@@ -42,7 +42,7 @@ func EncodeAuthToBase64(authConfig types.AuthConfig) (string, error) {
42 42
 	return base64.URLEncoding.EncodeToString(buf), nil
43 43
 }
44 44
 
45
-// RegistryAuthenticationPrivilegedFunc return a RequestPrivilegeFunc from the specified registry index info
45
+// RegistryAuthenticationPrivilegedFunc returns a RequestPrivilegeFunc from the specified registry index info
46 46
 // for the given command.
47 47
 func (cli *DockerCli) RegistryAuthenticationPrivilegedFunc(index *registrytypes.IndexInfo, cmdName string) types.RequestPrivilegeFunc {
48 48
 	return func() (string, error) {
... ...
@@ -103,7 +103,7 @@ func (cli *DockerCli) ConfigureAuth(flUser, flPassword, serverAddress string, is
103 103
 	// will hit this if you attempt docker login from mintty where stdin
104 104
 	// is a pipe, not a character based console.
105 105
 	if flPassword == "" && !cli.isTerminalIn {
106
-		return authconfig, fmt.Errorf("Error: Cannot perform an interactive logon from a non TTY device")
106
+		return authconfig, fmt.Errorf("Error: Cannot perform an interactive login from a non TTY device")
107 107
 	}
108 108
 
109 109
 	authconfig.Username = strings.TrimSpace(authconfig.Username)
... ...
@@ -7,12 +7,12 @@ import (
7 7
 	"github.com/spf13/cobra"
8 8
 )
9 9
 
10
-// NewStackCommand returns nocommand
10
+// NewStackCommand returns no command
11 11
 func NewStackCommand(dockerCli *client.DockerCli) *cobra.Command {
12 12
 	return &cobra.Command{}
13 13
 }
14 14
 
15
-// NewTopLevelDeployCommand return no command
15
+// NewTopLevelDeployCommand returns no command
16 16
 func NewTopLevelDeployCommand(dockerCli *client.DockerCli) *cobra.Command {
17 17
 	return &cobra.Command{}
18 18
 }