From 07bbca426ef51ecf007ac2640320a07cfd98e9c2 Mon Sep 17 00:00:00 2001 From: Emiliano Ticci Date: Wed, 4 Dec 2013 12:29:09 +0100 Subject: [PATCH] NFS/VBox: remove dedicated cleanup action in favour of native routine. --- plugins/providers/virtualbox/action.rb | 3 --- .../virtualbox/action/prune_nfs_exports.rb | 20 ------------------- plugins/synced_folders/nfs/synced_folder.rb | 7 +++++++ 3 files changed, 7 insertions(+), 23 deletions(-) delete mode 100644 plugins/providers/virtualbox/action/prune_nfs_exports.rb diff --git a/plugins/providers/virtualbox/action.rb b/plugins/providers/virtualbox/action.rb index 70b83f3f3..c20ec20f2 100644 --- a/plugins/providers/virtualbox/action.rb +++ b/plugins/providers/virtualbox/action.rb @@ -35,7 +35,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__) @@ -58,7 +57,6 @@ module VagrantPlugins b.use EnvSet, :port_collision_repair => true b.use PrepareForwardedPortCollisionParams b.use HandleForwardedPortCollisions - b.use PruneNFSExports b.use ClearSharedFolders b.use SyncedFolderCleanup b.use SyncedFolders @@ -93,7 +91,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)