Expand the NFS shared folder path relative to root path during the extraction.

This commit is contained in:
Mitchell Hashimoto 2010-07-20 13:18:00 -07:00
parent 061bdad68a
commit c875e4345a
3 changed files with 12 additions and 8 deletions

View File

@ -48,13 +48,6 @@ module Vagrant
# Returns the folders which are to be synced via NFS.
def folders
@folders ||= {}
@folders.inject({}) do |acc, data|
key, opts = data
opts = opts.dup
opts[:hostpath] = File.expand_path(opts[:hostpath], @env.env.root_path)
acc[key] = opts
acc
end
end
# Removes the NFS enabled shared folders from the configuration,
@ -66,7 +59,10 @@ module Vagrant
key, opts = data
if opts[:nfs]
# Duplicate the options, set the hostpath, and set disabled on the original
# options so the ShareFolders middleware doesn't try to mount it.
acc[key] = opts.dup
acc[key][:hostpath] = File.expand_path(opts[:hostpath], @env.env.root_path)
opts[:disabled] = true
end

View File

@ -112,6 +112,14 @@ class NFSVMActionTest < Test::Unit::TestCase
assert @env["config"].vm.shared_folders[key][:disabled]
end
end
should "expand the hostpath relative to the env root" do
@instance.extract_folders
%W[v-foo v-bar].each do |key|
opts = @env["config"].vm.shared_folders[key]
assert_equal File.expand_path(opts[:hostpath], @env.env.root_path), @instance.folders[key][:hostpath]
end
end
end
context "preparing UID/GID" do

View File

@ -9,7 +9,7 @@ Gem::Specification.new do |s|
s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
s.authors = ["Mitchell Hashimoto", "John Bender"]
s.date = %q{2010-07-19}
s.date = %q{2010-07-20}
s.default_executable = %q{vagrant}
s.description = %q{Vagrant is a tool for building and distributing virtualized development environments.}
s.email = ["mitchell.hashimoto@gmail.com", "john.m.bender@gmail.com"]