Fix redis-trib cluster create

Under certain conditions the node list wasn't being fully populated
and 'create' would fail trying to call methods on nil objects.
This commit is contained in:
Matt Stancliff 2015-01-08 13:28:35 -05:00
parent 622c69e93d
commit 1c477f62bc

View File

@ -563,8 +563,17 @@ class RedisTrib
# Take one node from each IP until we run out of nodes # Take one node from each IP until we run out of nodes
# across every IP. # across every IP.
ips.each do |ip,nodes| ips.each do |ip,nodes|
stop = nodes.empty? and next if nodes.empty?
interleaved.push nodes.shift # if this IP has no remaining nodes, check for termination
if interleaved.length == nodes_count
# stop when 'interleaved' has accumulated all nodes
stop = true
next
end
else
# else, move one node from this IP to 'interleaved'
interleaved.push nodes.shift
end
end end
end end