Only prepare NFS settings for VirtualBox if NFS is enabled

This commit is contained in:
Mitchell Hashimoto 2013-03-18 13:21:06 -07:00
parent 91ebe323f1
commit c94f61d274
1 changed files with 14 additions and 3 deletions

View File

@ -10,10 +10,21 @@ module VagrantPlugins
def call(env)
@app.call(env)
env[:nfs_host_ip] = read_host_ip(env[:machine])
env[:nfs_machine_ip] = read_machine_ip(env[:machine])
using_nfs = false
env[:machine].config.vm.synced_folders.each do |id, opts|
if opts[:nfs]
using_nfs = true
break
end
end
raise Vagrant::Errors::NFSNoHostonlyNetwork if !env[:nfs_machine_ip]
if using_nfs
@logger.info("Using NFS, preparing NFS settings by reading host IP and machine IP")
env[:nfs_host_ip] = read_host_ip(env[:machine])
env[:nfs_machine_ip] = read_machine_ip(env[:machine])
raise Vagrant::Errors::NFSNoHostonlyNetwork if !env[:nfs_machine_ip]
end
end
# Returns the IP address of the first host only network adapter