core: Fix synced folder creation (AKA first bug caught with vagrant-spec)

Thanks @mitchellh!
This commit is contained in:
Fabio Rehm 2014-03-12 21:53:52 -03:00
parent 37ffd4e477
commit 35feb11367

View file

@ -62,21 +62,21 @@ module Vagrant
def share_folders(folders) def share_folders(folders)
folders.each do |folder| folders.each do |folder|
guestpath = rootfs_path.join(folder[:guestpath].gsub(/^\//, '')) share_folder(folder[:hostpath], folder[:guestpath])
unless guestpath.directory?
begin
@logger.debug("Guest path doesn't exist, creating: #{guestpath}")
@sudo_wrapper.run('mkdir', '-p', guestpath.to_s)
rescue Errno::EACCES
raise Vagrant::Errors::SharedFolderCreateFailed, :path => guestpath.to_s
end
end
share_folder(folder[:hostpath], guestpath)
end end
end end
def share_folder(host_path, guest_path) def share_folder(host_path, guest_path)
guest_path = rootfs_path.join(guest_path.gsub(/^\//, ''))
unless guest_path.directory?
begin
@logger.debug("Guest path doesn't exist, creating: #{guest_path}")
@sudo_wrapper.run('mkdir', '-p', guest_path.to_s)
rescue Errno::EACCES
raise Vagrant::Errors::SharedFolderCreateFailed, :path => guest_path.to_s
end
end
@customizations << ['mount.entry', "#{host_path} #{guest_path} none bind 0 0"] @customizations << ['mount.entry', "#{host_path} #{guest_path} none bind 0 0"]
end end