mirror of https://github.com/docker/docs.git
fix storage-path bug
Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>
This commit is contained in:
parent
4ca4a28788
commit
abd43e8d18
29
commands.go
29
commands.go
|
@ -374,15 +374,36 @@ func cmdCreate(c *cli.Context) {
|
||||||
log.Fatal("You must specify a machine name")
|
log.Fatal("You must specify a machine name")
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := setupCertificates(c.GlobalString("tls-ca-cert"), c.GlobalString("tls-ca-key"),
|
// setup cert paths
|
||||||
c.GlobalString("tls-client-cert"), c.GlobalString("tls-client-key")); err != nil {
|
caCertPath := c.GlobalString("tls-ca-cert")
|
||||||
|
caKeyPath := c.GlobalString("tls-ca-key")
|
||||||
|
clientCertPath := c.GlobalString("tls-client-cert")
|
||||||
|
clientKeyPath := c.GlobalString("tls-client-key")
|
||||||
|
|
||||||
|
if caCertPath == "" {
|
||||||
|
caCertPath = filepath.Join(utils.GetMachineCertDir(), "ca.pem")
|
||||||
|
}
|
||||||
|
|
||||||
|
if caKeyPath == "" {
|
||||||
|
caKeyPath = filepath.Join(utils.GetMachineCertDir(), "ca-key.pem")
|
||||||
|
}
|
||||||
|
|
||||||
|
if clientCertPath == "" {
|
||||||
|
clientCertPath = filepath.Join(utils.GetMachineCertDir(), "cert.pem")
|
||||||
|
}
|
||||||
|
|
||||||
|
if clientKeyPath == "" {
|
||||||
|
clientKeyPath = filepath.Join(utils.GetMachineCertDir(), "key.pem")
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := setupCertificates(caCertPath, caKeyPath, clientCertPath, clientKeyPath); err != nil {
|
||||||
log.Fatalf("Error generating certificates: %s", err)
|
log.Fatalf("Error generating certificates: %s", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
defaultStore, err := getDefaultStore(
|
defaultStore, err := getDefaultStore(
|
||||||
c.GlobalString("storage-path"),
|
c.GlobalString("storage-path"),
|
||||||
c.GlobalString("tls-ca-cert"),
|
caCertPath,
|
||||||
c.GlobalString("tls-ca-key"),
|
caKeyPath,
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
|
|
11
main.go
11
main.go
|
@ -3,7 +3,6 @@ package main
|
||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
"path"
|
"path"
|
||||||
"path/filepath"
|
|
||||||
|
|
||||||
log "github.com/Sirupsen/logrus"
|
log "github.com/Sirupsen/logrus"
|
||||||
"github.com/codegangsta/cli"
|
"github.com/codegangsta/cli"
|
||||||
|
@ -39,32 +38,32 @@ func main() {
|
||||||
cli.StringFlag{
|
cli.StringFlag{
|
||||||
EnvVar: "MACHINE_STORAGE_PATH",
|
EnvVar: "MACHINE_STORAGE_PATH",
|
||||||
Name: "storage-path",
|
Name: "storage-path",
|
||||||
Value: utils.GetMachineRoot(),
|
Value: utils.GetBaseDir(),
|
||||||
Usage: "Configures storage path",
|
Usage: "Configures storage path",
|
||||||
},
|
},
|
||||||
cli.StringFlag{
|
cli.StringFlag{
|
||||||
EnvVar: "MACHINE_TLS_CA_CERT",
|
EnvVar: "MACHINE_TLS_CA_CERT",
|
||||||
Name: "tls-ca-cert",
|
Name: "tls-ca-cert",
|
||||||
Usage: "CA to verify remotes against",
|
Usage: "CA to verify remotes against",
|
||||||
Value: filepath.Join(utils.GetMachineCertDir(), "ca.pem"),
|
Value: "",
|
||||||
},
|
},
|
||||||
cli.StringFlag{
|
cli.StringFlag{
|
||||||
EnvVar: "MACHINE_TLS_CA_KEY",
|
EnvVar: "MACHINE_TLS_CA_KEY",
|
||||||
Name: "tls-ca-key",
|
Name: "tls-ca-key",
|
||||||
Usage: "Private key to generate certificates",
|
Usage: "Private key to generate certificates",
|
||||||
Value: filepath.Join(utils.GetMachineCertDir(), "ca-key.pem"),
|
Value: "",
|
||||||
},
|
},
|
||||||
cli.StringFlag{
|
cli.StringFlag{
|
||||||
EnvVar: "MACHINE_TLS_CLIENT_CERT",
|
EnvVar: "MACHINE_TLS_CLIENT_CERT",
|
||||||
Name: "tls-client-cert",
|
Name: "tls-client-cert",
|
||||||
Usage: "Client cert to use for TLS",
|
Usage: "Client cert to use for TLS",
|
||||||
Value: filepath.Join(utils.GetMachineCertDir(), "cert.pem"),
|
Value: "",
|
||||||
},
|
},
|
||||||
cli.StringFlag{
|
cli.StringFlag{
|
||||||
EnvVar: "MACHINE_TLS_CLIENT_KEY",
|
EnvVar: "MACHINE_TLS_CLIENT_KEY",
|
||||||
Name: "tls-client-key",
|
Name: "tls-client-key",
|
||||||
Usage: "Private key used in client TLS auth",
|
Usage: "Private key used in client TLS auth",
|
||||||
Value: filepath.Join(utils.GetMachineCertDir(), "key.pem"),
|
Value: "",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ func GetHomeDir() string {
|
||||||
func GetBaseDir() string {
|
func GetBaseDir() string {
|
||||||
baseDir := os.Getenv("MACHINE_STORAGE_PATH")
|
baseDir := os.Getenv("MACHINE_STORAGE_PATH")
|
||||||
if baseDir == "" {
|
if baseDir == "" {
|
||||||
baseDir = filepath.Join(GetHomeDir(), ".docker")
|
baseDir = filepath.Join(GetHomeDir(), ".docker", "machine")
|
||||||
}
|
}
|
||||||
return baseDir
|
return baseDir
|
||||||
}
|
}
|
||||||
|
@ -31,20 +31,16 @@ func GetDockerDir() string {
|
||||||
return filepath.Join(GetHomeDir(), ".docker")
|
return filepath.Join(GetHomeDir(), ".docker")
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetMachineRoot() string {
|
|
||||||
return filepath.Join(GetBaseDir(), "machine")
|
|
||||||
}
|
|
||||||
|
|
||||||
func GetMachineDir() string {
|
func GetMachineDir() string {
|
||||||
return filepath.Join(GetMachineRoot(), "machines")
|
return filepath.Join(GetBaseDir(), "machines")
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetMachineCertDir() string {
|
func GetMachineCertDir() string {
|
||||||
return filepath.Join(GetMachineRoot(), "certs")
|
return filepath.Join(GetBaseDir(), "certs")
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetMachineCacheDir() string {
|
func GetMachineCacheDir() string {
|
||||||
return filepath.Join(GetMachineRoot(), "cache")
|
return filepath.Join(GetBaseDir(), "cache")
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetUsername() string {
|
func GetUsername() string {
|
||||||
|
|
Loading…
Reference in New Issue