From 35feb11367fbfc9ef28007d77e7a7a1ff0196725 Mon Sep 17 00:00:00 2001 From: Fabio Rehm Date: Wed, 12 Mar 2014 21:53:52 -0300 Subject: [PATCH] core: Fix synced folder creation (AKA first bug caught with vagrant-spec) Thanks @mitchellh! --- lib/vagrant-lxc/driver.rb | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/lib/vagrant-lxc/driver.rb b/lib/vagrant-lxc/driver.rb index 74b0888..7c09ec1 100644 --- a/lib/vagrant-lxc/driver.rb +++ b/lib/vagrant-lxc/driver.rb @@ -62,21 +62,21 @@ module Vagrant def share_folders(folders) folders.each do |folder| - guestpath = rootfs_path.join(folder[:guestpath].gsub(/^\//, '')) - 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) + share_folder(folder[:hostpath], folder[:guestpath]) end end 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"] end