def configure_chef
      # setup logger for mixlib-shellout gem to consume instead of the chef
      # v0.10.10 behavior of not logging ShellOut calls by default. also setup
      # command failure exception and callback for legacy reasons.
      ::Mixlib::ShellOut.default_logger = ::Chef::Log
      ::Mixlib::ShellOut.command_failure_callback = lambda do |params|
        failure_reason       = ::RightScale::SubprocessFormatting.reason(params[:status])
        expected_error_codes = Array(params[:args][:returns]).join(' or ')
        ::RightScale::Exceptions::Exec.new("\"#{params[:args][:command]}\" #{failure_reason}, expected #{expected_error_codes}.",
                                           params[:args][:cwd])
      end

      # Chef run mode is always solo for cook
      Chef::Config[:solo] = true

      # determine default cookbooks path.  If debugging cookbooks, place the debug pat(s) first, otherwise
      # clear out the list as it will be filled out with cookbooks needed for this converge as they are downloaded.
      if CookState.use_cookbooks_path?
        Chef::Config[:cookbook_path] = [CookState.cookbooks_path].flatten
        @audit.append_info("Using development cookbooks repositories path:\n\t- #{Chef::Config[:cookbook_path].join("\n\t- ")}")
      else
        # reset the cookbook path.  Will be filled out with cookbooks needed for this execution
        Chef::Config[:cookbook_path] = []
      end
      # add the rightscript cookbook if there are rightscripts in this converge
      Chef::Config[:cookbook_path] << @right_scripts_cookbook.repo_dir unless @right_scripts_cookbook.empty?

      # must set file cache path and ensure it exists otherwise evented run_command will fail
      file_cache_path                         = File.join(AgentConfig.cache_dir, 'chef')
      Chef::Config[:file_cache_path]        = file_cache_path
      FileUtils.mkdir_p(Chef::Config[:file_cache_path])

      Chef::Config[:cache_options][:path]   = File.join(file_cache_path, 'checksums')
      FileUtils.mkdir_p(Chef::Config[:cache_options][:path])

      # Where backups of chef-managed files should go.  Set to nil to backup to the same directory the file being backed up is in.
      Chef::Config[:file_backup_path] = nil

      # Chef 11+ defaults client_fork to true which cause Chef::Client to fork
      # This create problems with right_popen - right_popen expects to be used inside running EM reactor
      # EM seems not to play well with forking
      Chef::Config[:client_fork] = false

      # Chef 11+ allow concurrent execution of the recipes in different theads,
      # by setting different lockfile per thread.
      Chef::Config[:lockfile] = File.join(Chef::Config[:file_cache_path], "chef-client-#{@thread_name}-running.pid")

      true
    end
def configure_chef
      # setup logger for mixlib-shellout gem to consume instead of the chef
      # v0.10.10 behavior of not logging ShellOut calls by default. also setup
      # command failure exception and callback for legacy reasons.
      ::Mixlib::ShellOut.default_logger = ::Chef::Log
      ::Mixlib::ShellOut.command_failure_callback = lambda do |params|
        failure_reason       = ::RightScale::SubprocessFormatting.reason(params[:status])
        expected_error_codes = Array(params[:args][:returns]).join(' or ')
        ::RightScale::Exceptions::Exec.new("\"#{params[:args][:command]}\" #{failure_reason}, expected #{expected_error_codes}.",
                                           params[:args][:cwd])
      end

      # Chef run mode is always solo for cook
      Chef::Config[:solo] = true

      # determine default cookbooks path.  If debugging cookbooks, place the debug pat(s) first, otherwise
      # clear out the list as it will be filled out with cookbooks needed for this converge as they are downloaded.
      if CookState.use_cookbooks_path?
        Chef::Config[:cookbook_path] = [CookState.cookbooks_path].flatten
        @audit.append_info("Using development cookbooks repositories path:\n\t- #{Chef::Config[:cookbook_path].join("\n\t- ")}")
      else
        # reset the cookbook path.  Will be filled out with cookbooks needed for this execution
        Chef::Config[:cookbook_path] = []
      end
      # add the rightscript cookbook if there are rightscripts in this converge
      Chef::Config[:cookbook_path] << @right_scripts_cookbook.repo_dir unless @right_scripts_cookbook.empty?

      # must set file cache path and ensure it exists otherwise evented run_command will fail
      file_cache_path                         = File.join(AgentConfig.cache_dir, 'chef')
      Chef::Config[:file_cache_path]        = file_cache_path
      FileUtils.mkdir_p(Chef::Config[:file_cache_path])

      Chef::Config[:cache_options][:path]   = File.join(file_cache_path, 'checksums')
      FileUtils.mkdir_p(Chef::Config[:cache_options][:path])

      # Where backups of chef-managed files should go.  Set to nil to backup to the same directory the file being backed up is in.
      Chef::Config[:file_backup_path] = nil

      # Chef 11+ defaults client_fork to true which cause Chef::Client to fork
      # This create problems with right_popen - right_popen expects to be used inside running EM reactor
      # EM seems not to play well with forking
      Chef::Config[:client_fork] = false

      # Chef 11+ allow concurrent execution of the recipes in different theads,
      # by setting different lockfile per thread.
      Chef::Config[:lockfile] = File.join(Chef::Config[:file_cache_path], "chef-client-#{@thread_name}-running.pid")

      true
    end
Configure chef so it can find cookbooks and so its logs go to the audits

 === Return
 true:: Always return true