Merge pull request #3910 from nathanleclaire/fix_config_cert_path
Fix 'docker-machine config' cert paths
This commit is contained in:
@@ -3,7 +3,9 @@ package commands
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/docker/machine/commands/mcndirs"
|
||||
"github.com/docker/machine/libmachine"
|
||||
"github.com/docker/machine/libmachine/check"
|
||||
"github.com/docker/machine/libmachine/log"
|
||||
@@ -24,15 +26,21 @@ func cmdConfig(c CommandLine, api libmachine.API) error {
|
||||
return err
|
||||
}
|
||||
|
||||
dockerHost, authOptions, err := check.DefaultConnChecker.Check(host, c.Bool("swarm"))
|
||||
dockerHost, _, err := check.DefaultConnChecker.Check(host, c.Bool("swarm"))
|
||||
if err != nil {
|
||||
return fmt.Errorf("Error running connection boilerplate: %s", err)
|
||||
}
|
||||
|
||||
log.Debug(dockerHost)
|
||||
|
||||
tlsCACert := filepath.Join(mcndirs.GetMachineDir(), host.Name, "ca.pem")
|
||||
tlsCert := filepath.Join(mcndirs.GetMachineDir(), host.Name, "cert.pem")
|
||||
tlsKey := filepath.Join(mcndirs.GetMachineDir(), host.Name, "key.pem")
|
||||
|
||||
// TODO(nathanleclaire): These magic strings for the certificate file
|
||||
// names should be cross-package constants.
|
||||
fmt.Printf("--tlsverify\n--tlscacert=%q\n--tlscert=%q\n--tlskey=%q\n-H=%s\n",
|
||||
authOptions.CaCertPath, authOptions.ClientCertPath, authOptions.ClientKeyPath, dockerHost)
|
||||
tlsCACert, tlsCert, tlsKey, dockerHost)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user