From b8f7526fc6333e5b67282e5b73eee497dd13ec34 Mon Sep 17 00:00:00 2001 From: Brian Goff Date: Fri, 16 Jan 2015 09:47:32 -0500 Subject: [PATCH] Make .dockercfg with json.MarshallIndent Fixes #10129 Makes the .dockercfg more human parsable. Also cleaned up the (technically) racey login test. Signed-off-by: Brian Goff --- integration-cli/docker_cli_login_test.go | 14 ++------------ registry/auth.go | 2 +- 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/integration-cli/docker_cli_login_test.go b/integration-cli/docker_cli_login_test.go index d2b927b11b..9bf90f3adc 100644 --- a/integration-cli/docker_cli_login_test.go +++ b/integration-cli/docker_cli_login_test.go @@ -2,7 +2,6 @@ package main import ( "bytes" - "io" "os/exec" "testing" ) @@ -10,17 +9,8 @@ import ( func TestLoginWithoutTTY(t *testing.T) { cmd := exec.Command(dockerBinary, "login") - // create a buffer with text then a new line as a return - buf := bytes.NewBuffer([]byte("buffer test string \n")) - - // use a pipe for stdin and manually copy the data so that - // the process does not get the TTY - in, err := cmd.StdinPipe() - if err != nil { - t.Fatal(err) - } - // copy the bytes into the commands stdin along with a new line - go io.Copy(in, buf) + // Send to stdin so the process does not get the TTY + cmd.Stdin = bytes.NewBufferString("buffer test string \n") // run the command and block until it's done if err := cmd.Run(); err == nil { diff --git a/registry/auth.go b/registry/auth.go index 102078d7a2..9d223f77ea 100644 --- a/registry/auth.go +++ b/registry/auth.go @@ -133,7 +133,7 @@ func SaveConfig(configFile *ConfigFile) error { configs[k] = authCopy } - b, err := json.Marshal(configs) + b, err := json.MarshalIndent(configs, "", "\t") if err != nil { return err }