diff --git a/lib/vagrant/provisioners/puppet.rb b/lib/vagrant/provisioners/puppet.rb index df92ebc88..2365ce177 100644 --- a/lib/vagrant/provisioners/puppet.rb +++ b/lib/vagrant/provisioners/puppet.rb @@ -11,11 +11,13 @@ module Vagrant attr_accessor :manifest_file attr_accessor :manifests_path attr_accessor :pp_path + attr_accessor :options def initialize @manifest_file = "" @manifests_path = "manifests" @pp_path = "/tmp/vagrant-puppet" + @options = [] end end @@ -66,7 +68,7 @@ module Vagrant end def run_puppet_client - command = "cd #{env.config.puppet.pp_path} && sudo -E puppet #{@manifest}" + command = "cd #{env.config.puppet.pp_path} && sudo -E puppet #{env.config.puppet.options.join(" ")} #{@manifest}" env.ui.info I18n.t("vagrant.provisioners.puppet.running_puppet") diff --git a/test/vagrant/provisioners/puppet_test.rb b/test/vagrant/provisioners/puppet_test.rb index 42dbdae6a..745e8b9fc 100644 --- a/test/vagrant/provisioners/puppet_test.rb +++ b/test/vagrant/provisioners/puppet_test.rb @@ -110,7 +110,13 @@ class PuppetProvisionerTest < Test::Unit::TestCase end should "cd into the pp_path directory and run puppet" do - @ssh.expects(:exec!).with("cd #{@env.config.puppet.pp_path} && sudo -E puppet #{@manifest}").once + @ssh.expects(:exec!).with("cd #{@env.config.puppet.pp_path} && sudo -E puppet #{@manifest}").once + @action.run_puppet_client + end + + should "cd into the pp_path directory and run puppet with given options" do + @env.config.puppet.options = ["--modulepath", "modules", "--verbose"] + @ssh.expects(:exec!).with("cd #{@env.config.puppet.pp_path} && sudo -E puppet --modulepath modules --verbose #{@manifest}").once @action.run_puppet_client end