embed: Delay setting initial cluster for YAML

NewConfig() sets an initial cluster (potentially using a default name)
but we should clear it in the event another discovery option has been
specified.

PR #7517 attempted to address this however it only worked if the name
was left as "default".

(Completely) Fixes #7516
This commit is contained in:
Jonathan Sokolowski 2017-03-28 16:26:02 +11:00
parent 65ad91b14d
commit d0d4b1378b

View File

@ -203,6 +203,8 @@ func (cfg *configYAML) configFromFile(path string) error {
return err
}
defaultInitialCluster := cfg.InitialCluster
err = yaml.Unmarshal(b, cfg)
if err != nil {
return err
@ -246,7 +248,8 @@ func (cfg *configYAML) configFromFile(path string) error {
cfg.ACUrls = []url.URL(u)
}
if (cfg.Durl != "" || cfg.DNSCluster != "") && cfg.InitialCluster == cfg.InitialClusterFromName(cfg.Name) {
// If a discovery flag is set, clear default initial cluster set by InitialClusterFromName
if (cfg.Durl != "" || cfg.DNSCluster != "") && cfg.InitialCluster == defaultInitialCluster {
cfg.InitialCluster = ""
}
if cfg.ClusterState == "" {