NFS/VBox: remove dedicated cleanup action in favour of native routine.

This commit is contained in:
Emiliano Ticci 2013-12-04 12:29:09 +01:00
parent 4f17a70c4e
commit 07bbca426e
3 changed files with 7 additions and 23 deletions

View File

@ -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

View File

@ -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

View File

@ -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)