Skip to content
This repository has been archived by the owner on Feb 18, 2021. It is now read-only.

Commit

Permalink
fix ringpop bootstrap code to allow empty entry (#223)
Browse files Browse the repository at this point in the history
  • Loading branch information
datoug authored Jun 16, 2017
1 parent 5ce1584 commit db794df
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions common/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,12 @@ func BootstrapRingpop(rp *ringpop.Ringpop, ipaddr string, port int, cfg configur
var rpHosts []string

if len(cfg.GetRingHosts()) > 0 {
// Trim the trailing comma in rpHosts
// For example: If rpHosts = "10.x.y.z,", we should trim
// it to say, rpHostsTrimmed = "10.x.y.z"
rpHostsTrimmed := strings.TrimRight(cfg.GetRingHosts(), ",")
rpHosts = strings.Split(rpHostsTrimmed, ",")
for _, host := range strings.Split(cfg.GetRingHosts(), ",") {
hostTrimed := strings.TrimSpace(host)
if len(hostTrimed) > 0 {
rpHosts = append(rpHosts, hostTrimed)
}
}
}

if len(rpHosts) == 0 {
Expand Down

0 comments on commit db794df

Please sign in to comment.