Skip to content

Commit

Permalink
etcdserver: clear error on DNS resolution fail on advertise URLs
Browse files Browse the repository at this point in the history
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
  • Loading branch information
gyuho committed Jan 23, 2018
1 parent 8025082 commit 2f809e3
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions etcdserver/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,16 @@ func (c *ServerConfig) advertiseMatchesCluster() error {
missing = append(missing, url)
}
}
mstr := strings.Join(missing, ",")
if len(missing) > 0 {
mstr := strings.Join(missing, ",")
umap := types.URLsMap(map[string]types.URLs{c.Name: c.PeerURLs})
return fmt.Errorf("--initial-advertise-peer-urls has %s but missing from --initial-cluster=%s", mstr, umap.String())
}

// resolved URLs from "--initial-advertise-peer-urls" and "--initial-cluster" did not match or failed
apStr := strings.Join(apurls, ",")
umap := types.URLsMap(map[string]types.URLs{c.Name: c.PeerURLs})
return fmt.Errorf("--initial-advertise-peer-urls has %s but missing from --initial-cluster=%s", mstr, umap.String())
return fmt.Errorf("failed to resolve %s to match --initial-cluster=%s", apStr, umap.String())
}

func (c *ServerConfig) MemberDir() string { return filepath.Join(c.DataDir, "member") }
Expand Down

0 comments on commit 2f809e3

Please sign in to comment.