diff options
author | Matt Stancliff <matt@genges.com> | 2014-10-23 13:44:42 -0400 |
---|---|---|
committer | Matt Stancliff <matt@genges.com> | 2014-10-29 15:08:35 -0400 |
commit | bbf1af2da34001cf1f3af808cc3972dbc78fc6ab (patch) | |
tree | 82b57cef9108aa2f6181f42bbb251b6191d05ee7 | |
parent | 6fbaeddf3f547217df9f808da80a716661bfa591 (diff) | |
download | redis-bbf1af2da34001cf1f3af808cc3972dbc78fc6ab.tar.gz |
Fix redis-trib.rb IP:Port disassembly for IPv6
IP format is now any of:
- 127.0.0.1:6379
- ::1:6379
-rwxr-xr-x | src/redis-trib.rb | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/redis-trib.rb b/src/redis-trib.rb index cff0f360f..466a81137 100755 --- a/src/redis-trib.rb +++ b/src/redis-trib.rb @@ -50,14 +50,16 @@ end class ClusterNode def initialize(addr) s = addr.split(":") - if s.length != 2 - puts "Invalid node name #{addr}" - exit 1 + if s.length < 2 + puts "Invalid IP or Port (given as #{addr}) - use IP:Port format" + exit 1 end + port = s.pop # removes port from split array + ip = s.join(":") # if s.length > 1 here, it's IPv6, so restore address @r = nil @info = {} - @info[:host] = s[0] - @info[:port] = s[1] + @info[:host] = ip + @info[:port] = port @info[:slots] = {} @info[:migrating] = {} @info[:importing] = {} |