From 4472ce1879d5f7a5cf65cd073d846f06e0d5fda6 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Tue, 13 Jul 2010 22:40:44 -0700 Subject: [PATCH] NFS cleanup methods on destroy --- lib/vagrant/action/builtin.rb | 1 + lib/vagrant/action/vm/nfs.rb | 2 +- test/vagrant/action/vm/nfs_test.rb | 4 ++-- vagrant.gemspec | 6 ++++++ 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/lib/vagrant/action/builtin.rb b/lib/vagrant/action/builtin.rb index ec55ea86d..cd7600980 100644 --- a/lib/vagrant/action/builtin.rb +++ b/lib/vagrant/action/builtin.rb @@ -72,6 +72,7 @@ module Vagrant # destroy - Halts, cleans up, and destroys an existing VM destroy = Builder.new do use Action[:halt], :force => true + use VM::ClearNFSExports use VM::DestroyUnusedNetworkInterfaces use VM::Destroy end diff --git a/lib/vagrant/action/vm/nfs.rb b/lib/vagrant/action/vm/nfs.rb index 4989a0696..adde686a3 100644 --- a/lib/vagrant/action/vm/nfs.rb +++ b/lib/vagrant/action/vm/nfs.rb @@ -32,8 +32,8 @@ module Vagrant extract_folders if !folders.empty? - export_folders clear_nfs_exports(env) + export_folders end return if env.error? diff --git a/test/vagrant/action/vm/nfs_test.rb b/test/vagrant/action/vm/nfs_test.rb index 674416c1c..65bd372e2 100644 --- a/test/vagrant/action/vm/nfs_test.rb +++ b/test/vagrant/action/vm/nfs_test.rb @@ -45,8 +45,8 @@ class NFSVMActionTest < Test::Unit::TestCase should "call the proper sequence and succeed" do seq = sequence('seq') @instance.expects(:extract_folders).in_sequence(seq) - @instance.expects(:export_folders).in_sequence(seq) @instance.expects(:clear_nfs_exports).with(@env).in_sequence(seq) + @instance.expects(:export_folders).in_sequence(seq) @app.expects(:call).with(@env).in_sequence(seq) @instance.expects(:mount_folders).in_sequence(seq) @instance.call(@env) @@ -69,8 +69,8 @@ class NFSVMActionTest < Test::Unit::TestCase seq = sequence('seq') @instance.expects(:extract_folders).in_sequence(seq) - @instance.expects(:export_folders).in_sequence(seq) @instance.expects(:clear_nfs_exports).in_sequence(seq) + @instance.expects(:export_folders).in_sequence(seq) @app.expects(:call).never @instance.call(@env) end diff --git a/vagrant.gemspec b/vagrant.gemspec index fb9323789..69be899d4 100644 --- a/vagrant.gemspec +++ b/vagrant.gemspec @@ -48,6 +48,7 @@ Gem::Specification.new do |s| "lib/vagrant/action/vm/boot.rb", "lib/vagrant/action/vm/check_guest_additions.rb", "lib/vagrant/action/vm/clear_forwarded_ports.rb", + "lib/vagrant/action/vm/clear_nfs_exports.rb", "lib/vagrant/action/vm/clear_shared_folders.rb", "lib/vagrant/action/vm/customize.rb", "lib/vagrant/action/vm/destroy.rb", @@ -60,6 +61,7 @@ Gem::Specification.new do |s| "lib/vagrant/action/vm/match_mac_address.rb", "lib/vagrant/action/vm/network.rb", "lib/vagrant/action/vm/nfs.rb", + "lib/vagrant/action/vm/nfs_helpers.rb", "lib/vagrant/action/vm/package.rb", "lib/vagrant/action/vm/persist.rb", "lib/vagrant/action/vm/provision.rb", @@ -133,6 +135,7 @@ Gem::Specification.new do |s| "test/vagrant/action/vm/boot_test.rb", "test/vagrant/action/vm/check_guest_additions_test.rb", "test/vagrant/action/vm/clear_forwarded_ports_test.rb", + "test/vagrant/action/vm/clear_nfs_exports_test.rb", "test/vagrant/action/vm/clear_shared_folders_test.rb", "test/vagrant/action/vm/customize_test.rb", "test/vagrant/action/vm/destroy_test.rb", @@ -144,6 +147,7 @@ Gem::Specification.new do |s| "test/vagrant/action/vm/import_test.rb", "test/vagrant/action/vm/match_mac_address_test.rb", "test/vagrant/action/vm/network_test.rb", + "test/vagrant/action/vm/nfs_helpers_test.rb", "test/vagrant/action/vm/nfs_test.rb", "test/vagrant/action/vm/package_test.rb", "test/vagrant/action/vm/persist_test.rb", @@ -215,6 +219,7 @@ Gem::Specification.new do |s| "test/vagrant/action/vm/boot_test.rb", "test/vagrant/action/vm/check_guest_additions_test.rb", "test/vagrant/action/vm/clear_forwarded_ports_test.rb", + "test/vagrant/action/vm/clear_nfs_exports_test.rb", "test/vagrant/action/vm/clear_shared_folders_test.rb", "test/vagrant/action/vm/customize_test.rb", "test/vagrant/action/vm/destroy_test.rb", @@ -226,6 +231,7 @@ Gem::Specification.new do |s| "test/vagrant/action/vm/import_test.rb", "test/vagrant/action/vm/match_mac_address_test.rb", "test/vagrant/action/vm/network_test.rb", + "test/vagrant/action/vm/nfs_helpers_test.rb", "test/vagrant/action/vm/nfs_test.rb", "test/vagrant/action/vm/package_test.rb", "test/vagrant/action/vm/persist_test.rb",