providers/virtualbox: define a sync_folders action to setup NFS

[GH-4344]
This commit is contained in:
Mitchell Hashimoto 2014-10-22 09:26:38 -07:00
parent 82f806f438
commit 7ccec33460
3 changed files with 21 additions and 1 deletions

View File

@ -14,6 +14,7 @@ BUG FIXES:
- providers/docker: Protocol is now honored in direct `ports settings.
- providers/docker: Images built using `build\_dir` will more robustly
capture the final image. [GH-4598]
- providers/docker: NFS synced folders now work. [GH-4344]
- providers/virtualbox: Show a human-friendly error if VirtualBox didn't
clean up an existing VM. [GH-4681]
- provisioners/docker: Search for docker binary in multiple places. [GH-4580]

View File

@ -292,6 +292,16 @@ module VagrantPlugins
end
end
# This is the action that is called to sync folders to a running
# machine without a reboot.
def self.action_sync_folders
Vagrant::Action::Builder.new.tap do |b|
b.use PrepareNFSValidIds
b.use SyncedFolders
b.use PrepareNFSSettings
end
end
# This action brings the machine up from nothing, including importing
# the box, configuring metadata, and booting.
def self.action_up

View File

@ -1,7 +1,10 @@
require "vagrant/action/builtin/mixin_synced_folders"
module VagrantPlugins
module ProviderVirtualBox
module Action
class PrepareNFSSettings
include Vagrant::Action::Builtin::MixinSyncedFolders
include Vagrant::Util::Retryable
def initialize(app, env)
@ -14,7 +17,13 @@ module VagrantPlugins
@app.call(env)
if using_nfs?
opts = {
cached: !!env[:synced_folders_cached],
config: env[:synced_folders_config],
}
folders = synced_folders(env[:machine], **opts)
if folders.has_key?(:nfs)
@logger.info("Using NFS, preparing NFS settings by reading host IP and machine IP")
add_ips_to_env!(env)
end