Avoid using the `/info` endpoint in the `login` and `logout` workflows
when the Registry endpoint is overriden by the user through the command
line.
Signed-off-by: Arnaud Porterie <arnaud.porterie@docker.com>
... | ... |
@@ -35,9 +35,11 @@ func (cli *DockerCli) CmdLogin(args ...string) error { |
35 | 35 |
cli.in = os.Stdin |
36 | 36 |
} |
37 | 37 |
|
38 |
- serverAddress := cli.electAuthServer() |
|
38 |
+ var serverAddress string |
|
39 | 39 |
if len(cmd.Args()) > 0 { |
40 | 40 |
serverAddress = cmd.Arg(0) |
41 |
+ } else { |
|
42 |
+ serverAddress = cli.electAuthServer() |
|
41 | 43 |
} |
42 | 44 |
|
43 | 45 |
authConfig, err := cli.configureAuth(*flUser, *flPassword, *flEmail, serverAddress) |
... | ... |
@@ -18,9 +18,11 @@ func (cli *DockerCli) CmdLogout(args ...string) error { |
18 | 18 |
|
19 | 19 |
cmd.ParseFlags(args, true) |
20 | 20 |
|
21 |
- serverAddress := cli.electAuthServer() |
|
21 |
+ var serverAddress string |
|
22 | 22 |
if len(cmd.Args()) > 0 { |
23 | 23 |
serverAddress = cmd.Arg(0) |
24 |
+ } else { |
|
25 |
+ serverAddress = cli.electAuthServer() |
|
24 | 26 |
} |
25 | 27 |
|
26 | 28 |
if _, ok := cli.configFile.AuthConfigs[serverAddress]; !ok { |