From 1f23b4caae6cd60a2bc1911c17fcebcadc539497 Mon Sep 17 00:00:00 2001 From: Victor Vieux Date: Fri, 24 May 2013 14:23:43 +0000 Subject: [PATCH 1/2] fix docker login when same username --- api.go | 8 ++++---- commands.go | 4 ++-- registry/registry.go | 7 ++++++- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/api.go b/api.go index 0a902c4043..216ae027ee 100644 --- a/api.go +++ b/api.go @@ -59,7 +59,7 @@ func getBoolParam(value string) (bool, error) { } func getAuth(srv *Server, version float64, w http.ResponseWriter, r *http.Request, vars map[string]string) error { - b, err := json.Marshal(srv.registry.GetAuthConfig()) + b, err := json.Marshal(srv.registry.GetAuthConfig(false)) if err != nil { return err } @@ -72,9 +72,9 @@ func postAuth(srv *Server, version float64, w http.ResponseWriter, r *http.Reque if err := json.NewDecoder(r.Body).Decode(config); err != nil { return err } - - if config.Username == srv.registry.GetAuthConfig().Username { - config.Password = srv.registry.GetAuthConfig().Password + authConfig := srv.registry.GetAuthConfig(true) + if config.Username == authConfig.Username { + config.Password = authConfig.Password } newAuthConfig := auth.NewAuthConfig(config.Username, config.Password, config.Email, srv.runtime.root) diff --git a/commands.go b/commands.go index 75ba562cd8..8c4630b828 100644 --- a/commands.go +++ b/commands.go @@ -1294,6 +1294,6 @@ func NewDockerCli(host string, port int) *DockerCli { } type DockerCli struct { - host string - port int + host string + port int } diff --git a/registry/registry.go b/registry/registry.go index ce9b4b4ac7..bd361b5e74 100644 --- a/registry/registry.go +++ b/registry/registry.go @@ -428,9 +428,14 @@ func (r *Registry) ResetClient(authConfig *auth.AuthConfig) { r.client.Jar = cookiejar.NewCookieJar() } -func (r *Registry) GetAuthConfig() *auth.AuthConfig { +func (r *Registry) GetAuthConfig(withPasswd bool) *auth.AuthConfig { + password := "" + if withPasswd { + password = r.authConfig.Password + } return &auth.AuthConfig{ Username: r.authConfig.Username, + Password: password, Email: r.authConfig.Email, } } From 8dc2ad2c06fabb6501f0adff80761898bed5bc6f Mon Sep 17 00:00:00 2001 From: kim0 Date: Fri, 24 May 2013 17:44:02 +0200 Subject: [PATCH 2/2] Avoid hardcoding kernel 3.8 version, allow Ubuntu updates to work --- docs/sources/installation/ubuntulinux.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/sources/installation/ubuntulinux.rst b/docs/sources/installation/ubuntulinux.rst index 6d2d3e671d..0aaa76250e 100644 --- a/docs/sources/installation/ubuntulinux.rst +++ b/docs/sources/installation/ubuntulinux.rst @@ -38,7 +38,7 @@ Due to a bug in LXC docker works best on the 3.8 kernel. Precise comes with a 3. .. code-block:: bash # install the backported kernel - sudo apt-get update && sudo apt-get install linux-image-3.8.0-19-generic + sudo apt-get update && sudo apt-get install linux-image-generic-lts-raring # reboot sudo reboot