Put back methods as instance methods

This commit is contained in:
Brian Cain 2020-05-18 10:39:21 -07:00
parent cfb9a6457e
commit 64ed950fd8
No known key found for this signature in database
GPG Key ID: 9FC4639B2E4510A0
2 changed files with 6 additions and 2 deletions

View File

@ -1,13 +1,15 @@
module Vagrant
module Util
module IPv4Interfaces
def self.ipv4_interfaces
def ipv4_interfaces
Socket.getifaddrs.select do |ifaddr|
ifaddr.addr && ifaddr.addr.ipv4?
end.map do |ifaddr|
[ifaddr.name, ifaddr.addr.ip_address]
end
end
extend IPv4Interfaces
end
end
end

View File

@ -13,7 +13,7 @@ module Vagrant
# @param [Integer] port Port to check.
# @return [Boolean] `true` if the port is open (listening), `false`
# otherwise.
def self.is_port_open?(host, port)
def is_port_open?(host, port)
# We wrap this in a timeout because once in awhile the TCPSocket
# _will_ hang, but this signals that the port is closed.
Timeout.timeout(1) do
@ -34,6 +34,8 @@ module Vagrant
# Any of the above exceptions signal that the port is closed.
return false
end
extend IsPortOpen
end
end
end