2013-04-08 22:30:41 +00:00
|
|
|
module VagrantPlugins
|
|
|
|
module GuestLinux
|
|
|
|
module Cap
|
|
|
|
class ReadIPAddress
|
|
|
|
def self.read_ip_address(machine)
|
2014-05-05 00:47:16 +00:00
|
|
|
command = "LANG=en ifconfig | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $1 }'"
|
2013-04-08 22:30:41 +00:00
|
|
|
result = ""
|
|
|
|
machine.communicate.execute(command) do |type, data|
|
|
|
|
result << data if type == :stdout
|
|
|
|
end
|
|
|
|
|
2013-06-09 20:27:08 +00:00
|
|
|
result.chomp.split("\n").first
|
2013-04-08 22:30:41 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|