Shared folders marked with `:disabled` flag will be ignored.
This commit is contained in:
parent
a5643d3239
commit
245ada2441
|
@ -63,14 +63,13 @@ module Vagrant
|
||||||
# Load the NFS enabled shared folders
|
# Load the NFS enabled shared folders
|
||||||
@folders = @env["config"].vm.shared_folders.inject({}) do |acc, data|
|
@folders = @env["config"].vm.shared_folders.inject({}) do |acc, data|
|
||||||
key, opts = data
|
key, opts = data
|
||||||
acc[key] = opts if opts[:nfs]
|
|
||||||
acc
|
|
||||||
end
|
|
||||||
|
|
||||||
# Delete them from the original configuration so they aren't
|
if opts[:nfs]
|
||||||
# mounted by the ShareFolders middleware
|
acc[key] = opts.dup
|
||||||
@folders.each do |key, opts|
|
opts[:disabled] = true
|
||||||
@env["config"].vm.shared_folders.delete(key)
|
end
|
||||||
|
|
||||||
|
acc
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,8 @@ module Vagrant
|
||||||
@env.env.config.vm.shared_folders.inject({}) do |acc, data|
|
@env.env.config.vm.shared_folders.inject({}) do |acc, data|
|
||||||
key, value = data
|
key, value = data
|
||||||
|
|
||||||
|
return acc if value[:disabled]
|
||||||
|
|
||||||
# This to prevent overwriting the actual shared folders data
|
# This to prevent overwriting the actual shared folders data
|
||||||
value = value.dup
|
value = value.dup
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,10 @@ class ForwardPortsVMActionTest < Test::Unit::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
context "checking for threshold" do
|
context "checking for threshold" do
|
||||||
|
setup do
|
||||||
|
@klass.any_instance.stubs(:external_collision_check)
|
||||||
|
end
|
||||||
|
|
||||||
should "error if has a port below threshold" do
|
should "error if has a port below threshold" do
|
||||||
@env.env.config.vm.forwarded_ports.clear
|
@env.env.config.vm.forwarded_ports.clear
|
||||||
@env.env.config.vm.forward_port("foo", 22, 222)
|
@env.env.config.vm.forward_port("foo", 22, 222)
|
||||||
|
|
|
@ -93,6 +93,7 @@ class NFSVMActionTest < Test::Unit::TestCase
|
||||||
|
|
||||||
context "extracting folders" do
|
context "extracting folders" do
|
||||||
setup do
|
setup do
|
||||||
|
@env.env.config.vm.shared_folders.clear
|
||||||
@env.env.config.vm.share_folder("v-foo", "/foo", ".", :nfs => true)
|
@env.env.config.vm.share_folder("v-foo", "/foo", ".", :nfs => true)
|
||||||
@env.env.config.vm.share_folder("v-bar", "/bar", ".", :nfs => true)
|
@env.env.config.vm.share_folder("v-bar", "/bar", ".", :nfs => true)
|
||||||
end
|
end
|
||||||
|
@ -102,10 +103,11 @@ class NFSVMActionTest < Test::Unit::TestCase
|
||||||
assert_equal 2, @instance.folders.length
|
assert_equal 2, @instance.folders.length
|
||||||
end
|
end
|
||||||
|
|
||||||
should "remove the folders from the original config" do
|
should "mark the folders disabled from the original config" do
|
||||||
@instance.extract_folders
|
@instance.extract_folders
|
||||||
assert_equal 1, @env["config"].vm.shared_folders.length
|
%W[v-foo v-bar].each do |key|
|
||||||
assert @env["config"].vm.shared_folders.has_key?("v-root")
|
assert @env["config"].vm.shared_folders[key][:disabled]
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -85,6 +85,14 @@ class ShareFoldersVMActionTest < Test::Unit::TestCase
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
should "ignore disabled shared folders" do
|
||||||
|
stub_shared_folders do |config|
|
||||||
|
config.vm.share_folder("v-root", "/vagrant", ".", :disabled => true)
|
||||||
|
end
|
||||||
|
|
||||||
|
assert @instance.shared_folders.empty?
|
||||||
|
end
|
||||||
|
|
||||||
should "append sync suffix if sync enabled to a folder" do
|
should "append sync suffix if sync enabled to a folder" do
|
||||||
name = "foo"
|
name = "foo"
|
||||||
guest = "bar"
|
guest = "bar"
|
||||||
|
|
Loading…
Reference in New Issue