Merge pull request #85 from ColinHebert/fix_no_ip

Check that the IP is set before adding a new line to the hosts file
This commit is contained in:
Paulo Bittencourt 2014-04-27 12:06:50 -04:00
commit 5f854824e2
2 changed files with 9 additions and 2 deletions

View File

@ -84,7 +84,9 @@ module VagrantPlugins
ip = get_ip_address(machine, resolving_machine)
host = machine.config.vm.hostname || machine.name
aliases = machine.config.hostmanager.aliases.join(' ').chomp
"#{ip}\t#{host} #{aliases}\n"
if ip != nil
"#{ip}\t#{host} #{aliases}\n"
end
end
def get_ip_address(machine, resolving_machine)

7
test/Vagrantfile vendored
View File

@ -33,4 +33,9 @@ Vagrant.configure('2') do |config|
server.vm.network :private_network, :ip => '10.0.5.4'
server.vm.provision :hostmanager
end
end
config.vm.define :server4 do |server|
server.vm.hostname = 'scruffy'
server.vm.provision :hostmanager
end
end