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,11 +10,22 @@ module VagrantPlugins
def call(env) def call(env)
@app.call(env) @app.call(env)
using_nfs = false
env[:machine].config.vm.synced_folders.each do |id, opts|
if opts[:nfs]
using_nfs = true
break
end
end
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_host_ip] = read_host_ip(env[:machine])
env[:nfs_machine_ip] = read_machine_ip(env[:machine]) env[:nfs_machine_ip] = read_machine_ip(env[:machine])
raise Vagrant::Errors::NFSNoHostonlyNetwork if !env[:nfs_machine_ip] raise Vagrant::Errors::NFSNoHostonlyNetwork if !env[:nfs_machine_ip]
end end
end
# Returns the IP address of the first host only network adapter # Returns the IP address of the first host only network adapter
# #