vagrant/plugins/guests/linux/cap/choose_addressable_ip_addr.rb

20 lines
394 B
Ruby
Raw Normal View History

2014-02-26 23:54:53 +00:00
module VagrantPlugins
module GuestLinux
module Cap
module ChooseAddressableIPAddr
def self.choose_addressable_ip_addr(machine, possible)
comm = machine.communicate
possible.each do |ip|
if comm.test("ping -c1 -w1 -W1 #{ip}")
return ip
2014-02-26 23:54:53 +00:00
end
end
return nil
2014-02-26 23:54:53 +00:00
end
end
end
end
end