diff --git a/plugins/providers/virtualbox/synced_folder.rb b/plugins/providers/virtualbox/synced_folder.rb index b40e9277b..89b006cf2 100644 --- a/plugins/providers/virtualbox/synced_folder.rb +++ b/plugins/providers/virtualbox/synced_folder.rb @@ -125,9 +125,8 @@ module VagrantPlugins hostpath: hostpath.to_s, transient: transient, SharedFoldersEnableSymlinksCreate: enable_symlink_create, - automount: data[:automount] - }.delete_if { |_,v| v.nil?} - + automount: !!data[:automount] + } end end diff --git a/test/unit/plugins/providers/virtualbox/synced_folder_test.rb b/test/unit/plugins/providers/virtualbox/synced_folder_test.rb index 2aaba1ac2..a5b121581 100644 --- a/test/unit/plugins/providers/virtualbox/synced_folder_test.rb +++ b/test/unit/plugins/providers/virtualbox/synced_folder_test.rb @@ -43,6 +43,7 @@ describe VagrantPlugins::ProviderVirtualBox::SyncedFolder do {:SharedFoldersEnableSymlinksCreate=>true, :guestpath=>"/folder", :hostpath=>"/Users/brian/vagrant-folder", + :automount=>false, :disabled=>false, :__vagrantfile=>true}} } @@ -50,6 +51,7 @@ describe VagrantPlugins::ProviderVirtualBox::SyncedFolder do {:SharedFoldersEnableSymlinksCreate=>false, :guestpath=>"/folder", :hostpath=>"/Users/brian/vagrant-folder", + :automount=>false, :disabled=>false, :__vagrantfile=>true}} } @@ -65,6 +67,7 @@ describe VagrantPlugins::ProviderVirtualBox::SyncedFolder do let(:folders_nosymvar) { {"/folder"=> {:guestpath=>"/folder", :hostpath=>"/Users/brian/vagrant-folder", + :automount=>false, :disabled=>false, :__vagrantfile=>true}} } @@ -75,26 +78,26 @@ describe VagrantPlugins::ProviderVirtualBox::SyncedFolder do end it "should prepare and share the folders" do - expect(driver).to receive(:share_folders).with([{:name=>"folder", :hostpath=>"/Users/brian/vagrant-folder", :transient=>false, :SharedFoldersEnableSymlinksCreate=>true}]) + expect(driver).to receive(:share_folders).with([{:name=>"folder", :hostpath=>"/Users/brian/vagrant-folder", :transient=>false, :automount=>false, :SharedFoldersEnableSymlinksCreate=>true}]) subject.prepare(machine, folders, nil) end it "should prepare and share the folders without symlinks enabled" do - expect(driver).to receive(:share_folders).with([{:name=>"folder", :hostpath=>"/Users/brian/vagrant-folder", :transient=>false, :SharedFoldersEnableSymlinksCreate=>false}]) + expect(driver).to receive(:share_folders).with([{:name=>"folder", :hostpath=>"/Users/brian/vagrant-folder", :transient=>false, :automount=>false, :SharedFoldersEnableSymlinksCreate=>false}]) subject.prepare(machine, folders_disabled, nil) end it "should prepare and share the folders without symlinks enabled with env var set" do stub_env('VAGRANT_DISABLE_VBOXSYMLINKCREATE'=>'1') - expect(driver).to receive(:share_folders).with([{:name=>"folder", :hostpath=>"/Users/brian/vagrant-folder", :transient=>false, :SharedFoldersEnableSymlinksCreate=>false}]) + expect(driver).to receive(:share_folders).with([{:name=>"folder", :hostpath=>"/Users/brian/vagrant-folder", :transient=>false, :automount=>false, :SharedFoldersEnableSymlinksCreate=>false}]) subject.prepare(machine, folders_nosymvar, nil) end it "should prepare and share the folders and override symlink setting" do stub_env('VAGRANT_DISABLE_VBOXSYMLINKCREATE'=>'1') - expect(driver).to receive(:share_folders).with([{:name=>"folder", :hostpath=>"/Users/brian/vagrant-folder", :transient=>false, :SharedFoldersEnableSymlinksCreate=>true}]) + expect(driver).to receive(:share_folders).with([{:name=>"folder", :hostpath=>"/Users/brian/vagrant-folder", :transient=>false, :automount=>false, :SharedFoldersEnableSymlinksCreate=>true}]) subject.prepare(machine, folders, nil) end