Clear NFS exports if an error occured in the environment in NFS

This commit is contained in:
Mitchell Hashimoto 2010-07-13 22:58:45 -07:00
parent 4472ce1879
commit 8dc839e0c7
2 changed files with 6 additions and 2 deletions

View File

@ -41,6 +41,7 @@ module Vagrant
@app.call(env)
mount_folders if !folders.empty? && !env.error?
clear_nfs_exports(env) if env.error?
end
# Returns the folders which are to be synced via NFS.

View File

@ -37,7 +37,7 @@ class NFSVMActionTest < Test::Unit::TestCase
setup do
@instance.stubs(:folders).returns([:a])
[:extract_folders, :export_folders, :mount_folders].each do |meth|
[:clear_nfs_exports, :extract_folders, :export_folders, :mount_folders].each do |meth|
@instance.stubs(meth)
end
end
@ -76,13 +76,16 @@ class NFSVMActionTest < Test::Unit::TestCase
end
should "not mount folders if an error occured" do
@app.expects(:call).with() do
seq = sequence("seq")
@app.expects(:call).in_sequence(seq).with() do
# Use this mark the env as error
@env.error!(:foo)
true
end
@instance.expects(:clear_nfs_exports).with(@env).in_sequence(seq)
@instance.expects(:mount_folders).never
@instance.call(@env)
end