Skip to content

Commit

Permalink
Merge pull request #12112 from spzala/automated-cherry-pick-of-#12018…
Browse files Browse the repository at this point in the history
…-upstream-release-3.4

Automated cherry pick of #12018
  • Loading branch information
gyuho authored Jul 7, 2020
2 parents 2acdf88 + 3193311 commit d3a702a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 19 deletions.
13 changes: 3 additions & 10 deletions etcdmain/etcd.go
Original file line number Diff line number Diff line change
Expand Up @@ -358,16 +358,9 @@ func startProxy(cfg *config) error {
}

cfg.ec.Dir = filepath.Join(cfg.ec.Dir, "proxy")
if fileutil.Exist(cfg.ec.Dir) {
err = fileutil.CheckDirPermission(cfg.ec.Dir, fileutil.PrivateDirMode)
if err != nil {
return err
}
} else {
err = os.MkdirAll(cfg.ec.Dir, fileutil.PrivateDirMode)
if err != nil {
return err
}
err = fileutil.TouchDirAll(cfg.ec.Dir)
if err != nil {
return err
}

var peerURLs []string
Expand Down
18 changes: 9 additions & 9 deletions pkg/transport/listener.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,17 +115,17 @@ func (info TLSInfo) Empty() bool {
}

func SelfCert(lg *zap.Logger, dirpath string, hosts []string, additionalUsages ...x509.ExtKeyUsage) (info TLSInfo, err error) {
if fileutil.Exist(dirpath) {
err = fileutil.CheckDirPermission(dirpath, fileutil.PrivateDirMode)
if err != nil {
return
}
} else {
if err = os.MkdirAll(dirpath, fileutil.PrivateDirMode); err != nil {
return
info.Logger = lg
err = fileutil.TouchDirAll(dirpath)
if err != nil {
if info.Logger != nil {
info.Logger.Warn(
"cannot create cert directory",
zap.Error(err),
)
}
return
}
info.Logger = lg

certPath := filepath.Join(dirpath, "cert.pem")
keyPath := filepath.Join(dirpath, "key.pem")
Expand Down

0 comments on commit d3a702a

Please sign in to comment.