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:
commit
5f854824e2
|
@ -84,8 +84,10 @@ module VagrantPlugins
|
||||||
ip = get_ip_address(machine, resolving_machine)
|
ip = get_ip_address(machine, resolving_machine)
|
||||||
host = machine.config.vm.hostname || machine.name
|
host = machine.config.vm.hostname || machine.name
|
||||||
aliases = machine.config.hostmanager.aliases.join(' ').chomp
|
aliases = machine.config.hostmanager.aliases.join(' ').chomp
|
||||||
|
if ip != nil
|
||||||
"#{ip}\t#{host} #{aliases}\n"
|
"#{ip}\t#{host} #{aliases}\n"
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def get_ip_address(machine, resolving_machine)
|
def get_ip_address(machine, resolving_machine)
|
||||||
custom_ip_resolver = machine.config.hostmanager.ip_resolver
|
custom_ip_resolver = machine.config.hostmanager.ip_resolver
|
||||||
|
|
|
@ -33,4 +33,9 @@ Vagrant.configure('2') do |config|
|
||||||
server.vm.network :private_network, :ip => '10.0.5.4'
|
server.vm.network :private_network, :ip => '10.0.5.4'
|
||||||
server.vm.provision :hostmanager
|
server.vm.provision :hostmanager
|
||||||
end
|
end
|
||||||
|
|
||||||
|
config.vm.define :server4 do |server|
|
||||||
|
server.vm.hostname = 'scruffy'
|
||||||
|
server.vm.provision :hostmanager
|
||||||
|
end
|
||||||
end
|
end
|
Loading…
Reference in New Issue