From 60fdb938ec0a70bbe9df33995084b36318d21108 Mon Sep 17 00:00:00 2001 From: Nathan LeClaire Date: Tue, 3 Feb 2015 11:31:57 -0800 Subject: [PATCH] Make config and env return empty URL instead of error This will return an empty URL and consequently the Docker client will fail to connect instead of spitting out an illegible error with the subshell method. Hopefully this will tip users off to the underlying source of the problem. Signed-off-by: Nathan LeClaire --- commands.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/commands.go b/commands.go index b9449abb1c..fa6fa2f7a4 100644 --- a/commands.go +++ b/commands.go @@ -279,7 +279,7 @@ func cmdConfig(c *cli.Context) { if err != nil { log.Fatal(err) } - fmt.Printf("--tls --tlscacert=%s --tlscert=%s --tlskey=%s -H %s", + fmt.Printf("--tls --tlscacert=%s --tlscert=%s --tlskey=%s -H=%q", cfg.caCertPath, cfg.clientCertPath, cfg.clientKeyPath, cfg.machineUrl) } @@ -554,7 +554,11 @@ func getMachineConfig(c *cli.Context) (*machineConfig, error) { clientKey := filepath.Join(utils.GetMachineClientCertDir(), "key.pem") machineUrl, err := machine.GetURL() if err != nil { - return nil, fmt.Errorf("Error getting machine url: %s", err) + if err == drivers.ErrHostIsNotRunning { + machineUrl = "" + } else { + return nil, fmt.Errorf("Unexpected error getting machine url: %s", err) + } } return &machineConfig{ caCertPath: caCert,