Chef server client.rb uses new templates

This commit is contained in:
Mitchell Hashimoto 2010-04-08 21:07:24 -07:00
parent 47a9d85b4e
commit 965e5a12f3
3 changed files with 24 additions and 18 deletions

View File

@ -39,24 +39,13 @@ module Vagrant
end
def setup_config
solo_file = <<-solo
log_level :info
log_location STDOUT
node_name "#{env.config.chef.node_name}"
ssl_verify_mode :verify_none
chef_server_url "#{env.config.chef.chef_server_url}"
validation_client_name "#{env.config.chef.validation_client_name}"
validation_key "#{guest_validation_key_path}"
client_key "#{env.config.chef.client_key_path}"
file_store_path "/srv/chef/file_store"
file_cache_path "/srv/chef/cache"
pid_file "/var/run/chef/chef-client.pid"
Mixlib::Log::Formatter.show_time = true
solo
solo_file = TemplateRenderer.render("chef_server_client", {
:node_name => env.config.chef.node_name,
:chef_server_url => env.config.chef.chef_server_url,
:validation_client_name => env.config.chef.validation_client_name,
:validation_key => guest_validation_key_path,
:client_key => env.config.chef.client_key_path
})
logger.info "Uploading chef-client configuration script..."
env.ssh.upload!(StringIO.new(solo_file), File.join(env.config.chef.provisioning_path, "client.rb"))

View File

@ -0,0 +1,16 @@
log_level :info
log_location STDOUT
node_name "<%= node_name %>"
ssl_verify_mode :verify_none
chef_server_url "<%= chef_server_url %>"
validation_client_name "<%= validation_client_name %>"
validation_key "<%= validation_key %>"
client_key "<%= client_key %>"
file_store_path "/srv/chef/file_store"
file_cache_path "/srv/chef/cache"
pid_file "/var/run/chef/chef-client.pid"
Mixlib::Log::Formatter.show_time = true

View File

@ -170,6 +170,7 @@ config
end
should "upload this file as client.rb to the provisioning folder" do
Vagrant::Util::TemplateRenderer.expects(:render).returns("foo")
StringIO.expects(:new).returns("foo")
File.expects(:join).with(@env.config.chef.provisioning_path, "client.rb").once.returns("bar")
@env.ssh.expects(:upload!).with("foo", "bar").once