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 <nathan.leclaire@gmail.com>
This commit is contained in:
Nathan LeClaire 2015-02-03 11:31:57 -08:00
parent 44d0720fe4
commit 60fdb938ec
1 changed files with 6 additions and 2 deletions

View File

@ -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,