Sha256: c4710ff7c669af79bb90d45d7c9d8e2592a4b8d88d0e6b0cfc2f26b641b815cc
Contents?: true
Size: 1.23 KB
Versions: 8
Compression:
Stored size: 1.23 KB
Contents
module Landrush module Cap module Linux module ReadHostVisibleIpAddress # # !!!!!!!!!!!! # !! NOTE !! # !!!!!!!!!!!! # # This is a fragile heuristic: we are simply assuming the IP address of # the last interface non-localhost IP address is the host-visible one. # # For VMWare, the interface that Vagrant uses is host accessible, so we # expect this to be the same as `read_ip_address`. # # For VirtualBox, the Vagrant interface is not host visible, so we add # our own private_network, which we expect this to return for us. # # If the Vagrantfile sets up any sort of fancy networking, this has the # potential to fail, which will break things. # # TODO: Find a better heuristic for this implementation. # def self.read_host_visible_ip_address(machine) command = "ifconfig | grep 'inet addr:' | grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $1 }'" result = "" machine.communicate.execute(command) do |type, data| result << data if type == :stdout end result.chomp.split("\n").last end end end end end
Version data entries
8 entries across 8 versions & 1 rubygems