diff --git a/api/client/commands.go b/api/client/commands.go index 5689dfd2cf39a4e425160c47b809b13ce46b137d..d5dfb2a37c2f36bb688a975a87d3ffaa578c7112 100644 --- a/api/client/commands.go +++ b/api/client/commands.go @@ -450,17 +450,18 @@ func (cli *DockerCli) CmdLogin(args ...string) error { if err != nil { return err } - var out2 engine.Env - err = out2.Decode(stream) - if err != nil { + + var response types.AuthResponse + if err := json.NewDecoder(stream).Decode(response); err != nil { cli.configFile, _ = registry.LoadConfig(homedir.Get()) return err } + registry.SaveConfig(cli.configFile) fmt.Fprintf(cli.out, "WARNING: login credentials saved in %s.\n", path.Join(homedir.Get(), registry.CONFIGFILE)) - if out2.Get("Status") != "" { - fmt.Fprintf(cli.out, "%s\n", out2.Get("Status")) + if response.Status != "" { + fmt.Fprintf(cli.out, "%s\n", response.Status) } return nil } diff --git a/api/server/server.go b/api/server/server.go index 1b9c5562fd36f8cb24a35933e3b4ad86261e4906..a11a4fd9ffd95be018a7e7f9e0e352c1c41cad82 100644 --- a/api/server/server.go +++ b/api/server/server.go @@ -192,7 +192,9 @@ func postAuth(eng *engine.Engine, version version.Version, w http.ResponseWriter if status := engine.Tail(stdoutBuffer, 1); status != "" { var env engine.Env env.Set("Status", status) - return writeJSONEnv(w, http.StatusOK, env) + return writeJSON(w, http.StatusOK, &types.AuthResponse{ + Status: status, + }) } w.WriteHeader(http.StatusNoContent) return nil diff --git a/api/types/types.go b/api/types/types.go index 5531135b1ddd3ed18259307e2cf6fcbaf56d9edd..21dba7729ee4fb863e1d9b96e30f4a25188b4cb9 100644 --- a/api/types/types.go +++ b/api/types/types.go @@ -18,3 +18,9 @@ type ContainerExecCreateResponse struct { // Warnings are any warnings encountered during the execution of the command. Warnings []string `json:"Warnings"` } + +// POST /auth +type AuthResponse struct { + // Status is the authentication status + Status string `json:"Status"` +}