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

fix ringpop bootstrap code to allow empty entry #223

Merged
merged 1 commit into from
Jun 16, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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