Do not ping registry from the cli

Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
This commit is contained in:
Michael Crosby 2014-02-05 16:49:43 -08:00
parent 7fb8738839
commit e2eace9715
3 changed files with 22 additions and 11 deletions

View File

@ -151,12 +151,15 @@ func SaveConfig(configFile *ConfigFile) error {
// try to register/login to the registry server
func Login(authConfig *AuthConfig, factory *utils.HTTPRequestFactory) (string, error) {
client := &http.Client{}
reqStatusCode := 0
var status string
var reqBody []byte
var (
status string
reqBody []byte
err error
client = &http.Client{}
reqStatusCode = 0
serverAddress = authConfig.ServerAddress
)
serverAddress := authConfig.ServerAddress
if serverAddress == "" {
serverAddress = IndexServerAddress()
}

View File

@ -266,11 +266,7 @@ func (cli *DockerCli) CmdLogin(args ...string) error {
}
serverAddress := auth.IndexServerAddress()
if len(cmd.Args()) > 0 {
serverAddress, err = registry.ExpandAndVerifyRegistryUrl(cmd.Arg(0))
if err != nil {
return err
}
fmt.Fprintf(cli.out, "Login against server at %s\n", serverAddress)
serverAddress = cmd.Arg(0)
}
promptDefault := func(prompt string, configDefault string) {

View File

@ -200,8 +200,20 @@ func (srv *Server) ContainerKill(job *engine.Job) engine.Status {
}
func (srv *Server) Auth(job *engine.Job) engine.Status {
authConfig := &auth.AuthConfig{}
var (
err error
authConfig = &auth.AuthConfig{}
)
job.GetenvJson("authConfig", authConfig)
// TODO: this is only done here because auth and registry need to be merged into one pkg
if addr := authConfig.ServerAddress; addr != "" && addr != auth.IndexServerAddress() {
addr, err = registry.ExpandAndVerifyRegistryUrl(addr)
if err != nil {
return job.Error(err)
}
authConfig.ServerAddress = addr
}
status, err := auth.Login(authConfig, srv.HTTPRequestFactory(nil))
if err != nil {
return job.Error(err)