change etcd dir permission if it exists

Signed-off-by: MonzElmasry <menna.elmasry@rancher.com>
This commit is contained in:
MonzElmasry 2021-01-06 19:05:49 +02:00
parent 6dabf7ac61
commit 86f68d5d62
No known key found for this signature in database
GPG Key ID: C22EA9B1FF03F73E

View File

@ -219,6 +219,17 @@ func (e *ETCD) Start(ctx context.Context, clientAccessInfo *clientaccess.Info) e
go e.manageLearners(ctx)
if existingCluster {
//check etcd dir permission
etcdDir := etcdDBDir(e.config)
info, err := os.Stat(etcdDir)
if err != nil {
return err
}
if info.Mode() != 0700 {
if err := os.Chmod(etcdDir, 0700); err != nil {
return err
}
}
opt, err := executor.CurrentETCDOptions()
if err != nil {
return err