From 64ed950fd8b7eaf2872f1911d1a7774ad3b7145f Mon Sep 17 00:00:00 2001 From: Brian Cain Date: Mon, 18 May 2020 10:39:21 -0700 Subject: [PATCH] Put back methods as instance methods --- lib/vagrant/util/ipv4_interfaces.rb | 4 +++- lib/vagrant/util/is_port_open.rb | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/vagrant/util/ipv4_interfaces.rb b/lib/vagrant/util/ipv4_interfaces.rb index 1d2af5d05..7ae486704 100644 --- a/lib/vagrant/util/ipv4_interfaces.rb +++ b/lib/vagrant/util/ipv4_interfaces.rb @@ -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 diff --git a/lib/vagrant/util/is_port_open.rb b/lib/vagrant/util/is_port_open.rb index f4b0f8f6d..1ae5f8208 100644 --- a/lib/vagrant/util/is_port_open.rb +++ b/lib/vagrant/util/is_port_open.rb @@ -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