Add nfs mount option to puppet provisioner

This mimics the equivalent feature from the chef_solo provisioner, and
mounts the puppet manifests and modules with NFS. Doing so can greatly
shortens the time of a puppet run if you have many .pp files.

Enabling this is optional. Virtualbox's (or any other provider's) shared
folders method stays the default. A typical usage would look like this:

    config.vm.provision :puppet do |puppet|
        puppet.manifests_path = "puppetmaster/manifests"
        puppet.module_path = ["puppetmaster/modules"]
        puppet.manifest_file  = "site.pp"
        puppet.nfs = true
    end

This fixes #1308.
This commit is contained in:
Marc Fournier 2013-06-24 17:10:16 +02:00
parent 4c850cedbc
commit 3822d8e1be
2 changed files with 5 additions and 2 deletions

View File

@ -10,6 +10,7 @@ module VagrantPlugins
attr_accessor :options
attr_accessor :temp_dir
attr_accessor :working_directory
attr_accessor :nfs
def initialize
super
@ -22,6 +23,7 @@ module VagrantPlugins
@facter = {}
@temp_dir = UNSET_VALUE
@working_directory = UNSET_VALUE
@nfs = UNSET_VALUE
end
def finalize!
@ -33,6 +35,7 @@ module VagrantPlugins
@module_path = nil if @module_path == UNSET_VALUE
@temp_dir = "/tmp/vagrant-puppet" if @temp_dir == UNSET_VALUE
@working_directory = nil if @working_directory == UNSET_VALUE
@nfs = false if @nfs == UNSET_VALUE
end
# Returns the manifests path expanded relative to the root path of the

View File

@ -29,14 +29,14 @@ module VagrantPlugins
# Share the manifests directory with the guest
root_config.vm.synced_folder(
@expanded_manifests_path, manifests_guest_path)
@expanded_manifests_path, manifests_guest_path, :nfs => @config.nfs)
# Share the module paths
count = 0
@module_paths.each do |from, to|
# Sorry for the cryptic key here, but VirtualBox has a strange limit on
# maximum size for it and its something small (around 10)
root_config.vm.synced_folder(from, to)
root_config.vm.synced_folder(from, to, :nfs => @config.nfs)
count += 1
end
end