Skip to content

Commit

Permalink
change etcd dir permission if it exists
Browse files Browse the repository at this point in the history
Signed-off-by: MonzElmasry <[email protected]>
  • Loading branch information
MonzElmasry committed Jan 8, 2021
1 parent 6dabf7a commit 3ec39a6
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion pkg/etcd/etcd.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,23 @@ func (e *ETCD) Test(ctx context.Context) error {
if err != nil {
return err
}

//check etcd dir permission
etcdDir := etcdDBDir(e.config)
info, err := os.Stat(etcdDir)
if err != nil {
return err
}
if info.Mode() != 0700 {
err = os.Chmod(etcdDir, 0700)
if err != nil {
return err
}
}
var memberNameUrls []string
for _, member := range members.Members {
for _, peerURL := range member.PeerURLs {
if peerURL == e.peerURL() && e.name == member.Name {

return nil
}
}
Expand Down Expand Up @@ -219,6 +231,7 @@ func (e *ETCD) Start(ctx context.Context, clientAccessInfo *clientaccess.Info) e
go e.manageLearners(ctx)

if existingCluster {

opt, err := executor.CurrentETCDOptions()
if err != nil {
return err
Expand Down

0 comments on commit 3ec39a6

Please sign in to comment.