From 5c2c5b9999fd0f392f518fa5c48a18bbd9d67131 Mon Sep 17 00:00:00 2001 From: Mike Fiedler Date: Thu, 18 Jul 2013 00:45:31 -0400 Subject: [PATCH] Adds formatter option to Chef Provisioner [GH-1250] --- plugins/provisioners/chef/config/base.rb | 3 +++ plugins/provisioners/chef/provisioner/base.rb | 3 ++- templates/provisioners/chef_client/client.erb | 4 ++++ templates/provisioners/chef_solo/solo.erb | 4 ++++ 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/plugins/provisioners/chef/config/base.rb b/plugins/provisioners/chef/config/base.rb index 7fffc32fd..aaf69632c 100644 --- a/plugins/provisioners/chef/config/base.rb +++ b/plugins/provisioners/chef/config/base.rb @@ -7,6 +7,7 @@ module VagrantPlugins attr_accessor :binary_path attr_accessor :binary_env attr_accessor :custom_config_path + attr_accessor :formatter attr_accessor :http_proxy attr_accessor :http_proxy_user attr_accessor :http_proxy_pass @@ -31,6 +32,7 @@ module VagrantPlugins @binary_path = UNSET_VALUE @binary_env = UNSET_VALUE @custom_config_path = UNSET_VALUE + @formatter = UNSET_VALUE @http_proxy = UNSET_VALUE @http_proxy_user = UNSET_VALUE @http_proxy_pass = UNSET_VALUE @@ -55,6 +57,7 @@ module VagrantPlugins @binary_path = nil if @binary_path == UNSET_VALUE @binary_env = nil if @binary_env == UNSET_VALUE @custom_config_path = nil if @custom_config_path == UNSET_VALUE + @formatter = nil if @formatter == UNSET_VALUE @http_proxy = nil if @http_proxy == UNSET_VALUE @http_proxy_user = nil if @http_proxy_user == UNSET_VALUE @http_proxy_pass = nil if @http_proxy_pass == UNSET_VALUE diff --git a/plugins/provisioners/chef/provisioner/base.rb b/plugins/provisioners/chef/provisioner/base.rb index b30de915e..b3cd8597f 100644 --- a/plugins/provisioners/chef/provisioner/base.rb +++ b/plugins/provisioners/chef/provisioner/base.rb @@ -71,7 +71,8 @@ module VagrantPlugins :https_proxy_user => @config.https_proxy_user, :https_proxy_pass => @config.https_proxy_pass, :log_level => @config.log_level.to_sym, - :no_proxy => @config.no_proxy + :no_proxy => @config.no_proxy, + :formatter => @config.formatter }.merge(template_vars)) # Create a temporary file to store the data so we diff --git a/templates/provisioners/chef_client/client.erb b/templates/provisioners/chef_client/client.erb index 7ac87521f..69a449a24 100644 --- a/templates/provisioners/chef_client/client.erb +++ b/templates/provisioners/chef_client/client.erb @@ -32,6 +32,10 @@ pid_file "/var/run/chef/chef-client.pid" Mixlib::Log::Formatter.show_time = true +<% if formatter %> +formatter "<%= formatter %>" +<% end %> + <% if custom_configuration -%> load "<%= custom_configuration %>" <% end -%> diff --git a/templates/provisioners/chef_solo/solo.erb b/templates/provisioners/chef_solo/solo.erb index a36b20b42..d88fb523d 100644 --- a/templates/provisioners/chef_solo/solo.erb +++ b/templates/provisioners/chef_solo/solo.erb @@ -28,6 +28,10 @@ https_proxy_user <%= https_proxy_user.inspect %> https_proxy_pass <%= https_proxy_pass.inspect %> no_proxy <%= no_proxy.inspect %> +<% if formatter %> +formatter "<%= formatter %>" +<% end %> + <% if custom_configuration -%> load "<%= custom_configuration %>" <% end -%>