Check that the IP is set before adding a new line

This commit is contained in:
Colin Hebert 2014-04-01 17:04:56 +11:00
parent e9265645e2
commit bc997adc3b
2 changed files with 9 additions and 2 deletions

View File

@ -80,7 +80,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