From 47a9d85b4ef1e5b5a809e8654fdcd073fa6ef56b Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Thu, 8 Apr 2010 20:56:48 -0700 Subject: [PATCH] Chef solo config uses new template system --- lib/vagrant/provisioners/chef_solo.rb | 8 ++++---- templates/chef_solo_solo.erb | 2 ++ test/vagrant/provisioners/chef_solo_test.rb | 1 + 3 files changed, 7 insertions(+), 4 deletions(-) create mode 100644 templates/chef_solo_solo.erb diff --git a/lib/vagrant/provisioners/chef_solo.rb b/lib/vagrant/provisioners/chef_solo.rb index 9d81517cb..35c185a49 100644 --- a/lib/vagrant/provisioners/chef_solo.rb +++ b/lib/vagrant/provisioners/chef_solo.rb @@ -20,10 +20,10 @@ module Vagrant end def setup_solo_config - solo_file = <<-solo -file_cache_path "#{env.config.chef.provisioning_path}" -cookbook_path #{cookbooks_path} -solo + solo_file = TemplateRenderer.render("chef_solo_solo", { + :provisioning_path => env.config.chef.provisioning_path, + :cookbooks_path => cookbooks_path + }) logger.info "Uploading chef-solo configuration script..." env.ssh.upload!(StringIO.new(solo_file), File.join(env.config.chef.provisioning_path, "solo.rb")) diff --git a/templates/chef_solo_solo.erb b/templates/chef_solo_solo.erb new file mode 100644 index 000000000..a615a2960 --- /dev/null +++ b/templates/chef_solo_solo.erb @@ -0,0 +1,2 @@ +file_cache_path "<%= provisioning_path %>" +cookbook_path <%= cookbooks_path %> diff --git a/test/vagrant/provisioners/chef_solo_test.rb b/test/vagrant/provisioners/chef_solo_test.rb index 2bc738e97..6b6f53aad 100644 --- a/test/vagrant/provisioners/chef_solo_test.rb +++ b/test/vagrant/provisioners/chef_solo_test.rb @@ -103,6 +103,7 @@ config end should "upload this file as solo.rb to the provisioning folder" do + Vagrant::Util::TemplateRenderer.expects(:render).returns("foo") @action.expects(:cookbooks_path).returns("cookbooks") StringIO.expects(:new).returns("foo") File.expects(:join).with(@env.config.chef.provisioning_path, "solo.rb").once.returns("bar")