<% unless @chef_requires.empty? %>
<%= @chef_requires.inspect %>.each do |lib|
  begin
    require lib
  rescue LoadError
    Chef::Log.warn "Failed to load #{lib}. This should be resolved after a chef run."
  end
end
<% end %>

log_level        :<%= @chef_log_level.to_s %>
log_location     <%= @chef_log_location %>
verbose_logging <%= @chef_verbose_logging %>

<% if node.attribute?("chef_client") && node["chef_client"]["server_url"] -%>
chef_server_url  "<%= node["chef_client"]["server_url"] %>"
<% else -%>
chef_server_url  "<%= Chef::Config[:chef_server_url] %>"
<% end -%>
validation_client_name "<%= node["chef_client"]["validation_client_name"] %>"
<% if @chef_node_name -%>
node_name "<%= @chef_node_name %>"
<% else -%>
# Using default node name
<% end -%>

file_backup_path   "<%= node["chef_client"]["backup_path"] %>"
file_cache_path    "<%= node["chef_client"]["cache_path"] %>"
cache_options({ :path => "<%= node["chef_client"]["checksum_cache_path"] %>", :skip_expires => <%= node["chef_client"]["checksum_cache_skip_expires"] %> })
<% unless %w{ runit bluepill daemontools }.include?(node["chef_client"]["init_style"]) -%>

pid_file           "<%= node["chef_client"]["run_path"] %>/client.pid"
<% end -%>
<%= "http_proxy         \"#{node["chef_client"]["http_proxy"]}\"\n" unless node["chef_client"]["http_proxy"].nil? -%>
<%= "https_proxy        \"#{node["chef_client"]["https_proxy"]}\"\n" unless node["chef_client"]["https_proxy"].nil? -%>
<%= "http_proxy_user    \"#{node["chef_client"]["http_proxy_user"]}\"\n" unless node["chef_client"]["http_proxy_user"].nil? -%>
<%= "http_proxy_pass    \"#{node["chef_client"]["http_proxy_pass"]}\"\n" unless node["chef_client"]["http_proxy_pass"].nil? -%>
<%= "no_proxy           \"#{node["chef_client"]["no_proxy"]}\"\n" unless node["chef_client"]["no_proxy"].nil? -%>
<% unless node["chef_client"]["http_proxy"].nil? -%>

# set the proxy env variable so rubygems works correctly
ENV['http_proxy'] = "<%= node["chef_client"]["http_proxy"] %>"
ENV['HTTP_PROXY'] = "<%= node["chef_client"]["http_proxy"] %>"
<% end -%>
<% if node.attribute?("ohai") && node["ohai"].attribute?("plugin_path") -%>

Ohai::Config[:plugin_path] << "<%= node["ohai"]["plugin_path"] %>"
<% end -%>

<% unless @ohai_disabled_plugins.empty? %>
Ohai::Config[:disabled_plugins] =  <%= @ohai_disabled_plugins %>
<% end -%>

<% if @chef_environment %>
environment "<%= @chef_environment %>"
<% end %>  

<% unless @chef_report_handlers.empty? %>
  <% @chef_report_handlers.each do |handler| %>
    report_handlers << <%= handler["class"] %>.new(<%= handler["arguments"].join(',') %>)
  <% end %>
<% end %>

<% unless @chef_exception_handlers.empty? %>
  <% @chef_exception_handlers.each do |handler| %>
    exception_handlers << <%= handler["class"] %>.new(<%= handler["arguments"].join(',') %>)
  <% end %>
<% end %>