config.puppet.options can be a string as well
This commit is contained in:
parent
6b46949550
commit
d0e3cf1210
|
@ -5,6 +5,7 @@
|
|||
- Solaris system registered, so it can be set with `:solaris`.
|
||||
- `vagrant package` include can be a directory name, which will cause the
|
||||
contents to be recursively copied into the package. [GH-241]
|
||||
- Arbitrary options to puppet binary can be set with `config.puppet.options`. [GH-242]
|
||||
|
||||
## 0.6.8 (November 30, 2010)
|
||||
|
||||
|
|
|
@ -64,11 +64,13 @@ module Vagrant
|
|||
return @manifest
|
||||
else
|
||||
raise PuppetError.new(:_key => :manifest_missing, :manifest => @manifest)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def run_puppet_client
|
||||
command = "cd #{env.config.puppet.pp_path} && sudo -E puppet #{env.config.puppet.options.join(" ")} #{@manifest}"
|
||||
options = env.config.puppet.options
|
||||
options = options.join(" ") if options.is_a?(Array)
|
||||
command = "cd #{env.config.puppet.pp_path} && sudo -E puppet #{options} #{@manifest}"
|
||||
|
||||
env.ui.info I18n.t("vagrant.provisioners.puppet.running_puppet")
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ class PuppetProvisionerTest < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
context "check manifest_dir" do
|
||||
setup do
|
||||
setup do
|
||||
@env.config.puppet.manifests_path = "manifests"
|
||||
end
|
||||
|
||||
|
@ -44,7 +44,7 @@ class PuppetProvisionerTest < Test::Unit::TestCase
|
|||
@action.check_manifest_dir
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
context "share manifests folder" do
|
||||
setup do
|
||||
@manifests_path = "manifests"
|
||||
|
@ -94,7 +94,7 @@ class PuppetProvisionerTest < Test::Unit::TestCase
|
|||
File.stubs(:exists?).with("#{@env.config.puppet.manifests_path}/#{@env.config.puppet.manifest_file}").returns(true)
|
||||
@action.set_manifest
|
||||
end
|
||||
|
||||
|
||||
should "raise an error if the manifest does not exist" do
|
||||
File.stubs(:exists?).with("#{@env.config.puppet.manifests_path}/#{@env.config.puppet.manifest_file}").returns(false)
|
||||
assert_raises(Vagrant::Provisioners::PuppetError) {
|
||||
|
@ -114,12 +114,18 @@ class PuppetProvisionerTest < Test::Unit::TestCase
|
|||
@action.run_puppet_client
|
||||
end
|
||||
|
||||
should "cd into the pp_path directory and run puppet with given options" do
|
||||
should "cd into the pp_path directory and run puppet with given options when given as an array" 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
|
||||
|
||||
should "cd into the pp_path directory and run puppet with the options when given as a string" 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
|
||||
|
||||
should "check the exit status if that is given" do
|
||||
@ssh.stubs(:exec!).yields(nil, :exit_status, :foo)
|
||||
@ssh.expects(:check_exit_status).with(:foo, anything).once
|
||||
|
|
Loading…
Reference in New Issue