Ensure IP is a string and not an array before connecting via UDP socket.

This commit is contained in:
Andus Lim 2015-06-23 09:58:21 +08:00
parent c834ba3285
commit d90da43f85

View File

@ -41,8 +41,13 @@ module VagrantPlugins
# @return [String]
def read_host_ip(ip)
UDPSocket.open do |s|
s.connect(ip, 1)
s.addr.last
@logger.info("!!!! ALL IPs #{ip} #{ip.kind_of?(Array)}" )
if ip.kind_of?(Array)
s.connect(ip[0], 1)
else
s.connect(ip, 1)
end
s.addr.last
end
end