Check that the IP is set before adding a new line
This commit is contained in:
parent
e9265645e2
commit
bc997adc3b
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue