mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
fix create folder before write info file
This commit is contained in:
22
etcd.go
22
etcd.go
@@ -47,6 +47,17 @@ func main() {
|
||||
log.Verbose = true
|
||||
}
|
||||
|
||||
// Setup a default directory based on the machine name
|
||||
if config.DataDir == "" {
|
||||
config.DataDir = config.Name + ".etcd"
|
||||
log.Warnf("Using the directory %s as the etcd configuration directory because a directory was not specified. ", config.DataDir)
|
||||
}
|
||||
|
||||
// Create data directory if it doesn't already exist.
|
||||
if err := os.MkdirAll(config.DataDir, 0744); err != nil {
|
||||
log.Fatalf("Unable to create path: %s", err)
|
||||
}
|
||||
|
||||
// Load info object.
|
||||
info, err := config.Info()
|
||||
if err != nil {
|
||||
@@ -61,17 +72,6 @@ func main() {
|
||||
info.Name = host
|
||||
}
|
||||
|
||||
// Setup a default directory based on the machine name
|
||||
if config.DataDir == "" {
|
||||
config.DataDir = info.Name + ".etcd"
|
||||
log.Warnf("Using the directory %s as the etcd configuration directory because a directory was not specified. ", config.DataDir)
|
||||
}
|
||||
|
||||
// Create data directory if it doesn't already exist.
|
||||
if err := os.MkdirAll(config.DataDir, 0744); err != nil {
|
||||
log.Fatalf("Unable to create path: %s", err)
|
||||
}
|
||||
|
||||
// Retrieve TLS configuration.
|
||||
tlsConfig, err := info.EtcdTLS.Config()
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user