Skip to content

Commit

Permalink
embed: only get initial cluster setting if the member is not init
Browse files Browse the repository at this point in the history
  • Loading branch information
xiang90 committed Jul 13, 2016
1 parent 06fd46f commit 2439932
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions embed/etcd.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (
"github.com/coreos/etcd/pkg/cors"
runtimeutil "github.com/coreos/etcd/pkg/runtime"
"github.com/coreos/etcd/pkg/transport"
"github.com/coreos/etcd/pkg/types"
"github.com/coreos/etcd/rafthttp"
"github.com/coreos/pkg/capnslog"
)
Expand Down Expand Up @@ -81,10 +82,16 @@ func StartEtcd(inCfg *Config) (e *Etcd, err error) {
e.Clients = append(e.Clients, sctx.l)
}

urlsmap, token, uerr := cfg.PeerURLsMapAndToken("etcd")
if uerr != nil {
err = fmt.Errorf("error setting up initial cluster: %v", uerr)
return
var (
urlsmap types.URLsMap
token string
)

if !isMemberInitialized(cfg) {
urlsmap, token, err = cfg.PeerURLsMapAndToken("etcd")
if err != nil {
return nil, fmt.Errorf("error setting up initial cluster: %v", err)
}
}

srvcfg := &etcdserver.ServerConfig{
Expand Down

0 comments on commit 2439932

Please sign in to comment.