18 lines
442 B
Ruby
18 lines
442 B
Ruby
|
module VagrantPlugins
|
||
|
module GuestLinux
|
||
|
module Cap
|
||
|
class ReadIPAddress
|
||
|
def self.read_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
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
end
|