mirror of
https://codeberg.org/redict/redict.git
synced 2025-01-23 00:28:26 -05:00
Fix redis-trib.rb IP:Port disassembly for IPv6
IP format is now any of: - 127.0.0.1:6379 - ::1:6379
This commit is contained in:
parent
6fbaeddf3f
commit
bbf1af2da3
@ -50,14 +50,16 @@ end
|
|||||||
class ClusterNode
|
class ClusterNode
|
||||||
def initialize(addr)
|
def initialize(addr)
|
||||||
s = addr.split(":")
|
s = addr.split(":")
|
||||||
if s.length != 2
|
if s.length < 2
|
||||||
puts "Invalid node name #{addr}"
|
puts "Invalid IP or Port (given as #{addr}) - use IP:Port format"
|
||||||
exit 1
|
exit 1
|
||||||
end
|
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
|
@r = nil
|
||||||
@info = {}
|
@info = {}
|
||||||
@info[:host] = s[0]
|
@info[:host] = ip
|
||||||
@info[:port] = s[1]
|
@info[:port] = port
|
||||||
@info[:slots] = {}
|
@info[:slots] = {}
|
||||||
@info[:migrating] = {}
|
@info[:migrating] = {}
|
||||||
@info[:importing] = {}
|
@info[:importing] = {}
|
||||||
|
Loading…
Reference in New Issue
Block a user