mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
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:
parent
65ad91b14d
commit
d0d4b1378b
@ -203,6 +203,8 @@ func (cfg *configYAML) configFromFile(path string) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
defaultInitialCluster := cfg.InitialCluster
|
||||||
|
|
||||||
err = yaml.Unmarshal(b, cfg)
|
err = yaml.Unmarshal(b, cfg)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@ -246,7 +248,8 @@ func (cfg *configYAML) configFromFile(path string) error {
|
|||||||
cfg.ACUrls = []url.URL(u)
|
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 = ""
|
cfg.InitialCluster = ""
|
||||||
}
|
}
|
||||||
if cfg.ClusterState == "" {
|
if cfg.ClusterState == "" {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user