From 3822d8e1befd14ac6376b80585fd9f8ff852b741 Mon Sep 17 00:00:00 2001 From: Marc Fournier Date: Mon, 24 Jun 2013 17:10:16 +0200 Subject: [PATCH] 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. --- plugins/provisioners/puppet/config/puppet.rb | 3 +++ plugins/provisioners/puppet/provisioner/puppet.rb | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/plugins/provisioners/puppet/config/puppet.rb b/plugins/provisioners/puppet/config/puppet.rb index c114ad900..e82774b42 100644 --- a/plugins/provisioners/puppet/config/puppet.rb +++ b/plugins/provisioners/puppet/config/puppet.rb @@ -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 diff --git a/plugins/provisioners/puppet/provisioner/puppet.rb b/plugins/provisioners/puppet/provisioner/puppet.rb index 485abd7bb..7e4916a04 100644 --- a/plugins/provisioners/puppet/provisioner/puppet.rb +++ b/plugins/provisioners/puppet/provisioner/puppet.rb @@ -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