From 86f68d5d62c224c30c21d2bc764efb4792043f54 Mon Sep 17 00:00:00 2001 From: MonzElmasry Date: Wed, 6 Jan 2021 19:05:49 +0200 Subject: [PATCH] change etcd dir permission if it exists Signed-off-by: MonzElmasry --- pkg/etcd/etcd.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/pkg/etcd/etcd.go b/pkg/etcd/etcd.go index 20857c0740..85a98b5fae 100644 --- a/pkg/etcd/etcd.go +++ b/pkg/etcd/etcd.go @@ -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