diff --git a/plugins/providers/virtualbox/action.rb b/plugins/providers/virtualbox/action.rb index d1e93a170..fb9a29654 100644 --- a/plugins/providers/virtualbox/action.rb +++ b/plugins/providers/virtualbox/action.rb @@ -34,7 +34,6 @@ module VagrantPlugins autoload :PackageVagrantfile, File.expand_path("../action/package_vagrantfile", __FILE__) autoload :PrepareNFSSettings, File.expand_path("../action/prepare_nfs_settings", __FILE__) autoload :PrepareForwardedPortCollisionParams, File.expand_path("../action/prepare_forwarded_port_collision_params", __FILE__) - autoload :PruneNFSExports, File.expand_path("../action/prune_nfs_exports", __FILE__) autoload :Resume, File.expand_path("../action/resume", __FILE__) autoload :SaneDefaults, File.expand_path("../action/sane_defaults", __FILE__) autoload :SetName, File.expand_path("../action/set_name", __FILE__) @@ -57,7 +56,6 @@ module VagrantPlugins b.use EnvSet, :port_collision_repair => true b.use PrepareForwardedPortCollisionParams b.use HandleForwardedPortCollisions - b.use PruneNFSExports b.use SyncedFolderCleanup b.use SyncedFolders b.use PrepareNFSSettings @@ -91,7 +89,6 @@ module VagrantPlugins b3.use CheckAccessible b3.use EnvSet, :force_halt => true b3.use action_halt - b3.use PruneNFSExports b3.use Destroy b3.use CleanMachineFolder b3.use DestroyUnusedNetworkInterfaces diff --git a/plugins/providers/virtualbox/action/prune_nfs_exports.rb b/plugins/providers/virtualbox/action/prune_nfs_exports.rb deleted file mode 100644 index 581988cc1..000000000 --- a/plugins/providers/virtualbox/action/prune_nfs_exports.rb +++ /dev/null @@ -1,20 +0,0 @@ -module VagrantPlugins - module ProviderVirtualBox - module Action - class PruneNFSExports - def initialize(app, env) - @app = app - end - - def call(env) - if env[:host] - vms = env[:machine].provider.driver.read_vms - env[:host].nfs_prune(vms.values) - end - - @app.call(env) - end - end - end - end -end diff --git a/plugins/synced_folders/nfs/synced_folder.rb b/plugins/synced_folders/nfs/synced_folder.rb index bb4649a50..62669a273 100644 --- a/plugins/synced_folders/nfs/synced_folder.rb +++ b/plugins/synced_folders/nfs/synced_folder.rb @@ -51,6 +51,13 @@ module VagrantPlugins :mount_nfs_folder, nfsopts[:nfs_host_ip], mount_folders) end + def cleanup(machine) + # Get the ID of all active machines. + ids = machine.env.active_machines.map { |m| machine.env.machine(m[0], m[1]).id } + + machine.env.host.nfs_prune(ids) + end + protected def prepare_folder(machine, opts)