read_ip_address linux cap only reads ip of first device [GH-1799]

This commit is contained in:
Mitchell Hashimoto 2013-06-09 13:27:08 -07:00
parent 80f06605fb
commit 5e48391b05
2 changed files with 4 additions and 2 deletions

View File

@ -31,6 +31,8 @@ BUG FIXES:
errors. [GH-1691]
- Setting hostname on SLES 11 works again. [GH-1781]
- `config.vm.guest` properly forces guests again. [GH-1800]
- The `read_ip_address` capability for linux properly reads the IP
of only the first network interface. [GH-1799]
## 1.2.2 (April 23, 2013)

View File

@ -3,13 +3,13 @@ module VagrantPlugins
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}'"
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
result.chomp.split("\n").first
end
end
end