Method: Chef::RunContext::CookbookCompiler#compile_ohai_plugins

Defined in:
lib/chef/run_context/cookbook_compiler.rb

#compile_ohai_pluginsObject

Loads Ohai Plugins from cookbooks, and ensure any old ones are properly cleaned out



148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
# File 'lib/chef/run_context/cookbook_compiler.rb', line 148

def compile_ohai_plugins
  ohai_plugin_count = count_files_by_segment(:ohai)
  events.ohai_plugin_load_start(ohai_plugin_count)
  FileUtils.rm_rf(Chef::Config[:ohai_segment_plugin_path])

  cookbook_order.each do |cookbook|
    load_ohai_plugins_from_cookbook(cookbook)
  end

  # Doing a full ohai system check is costly, so only do so if we've loaded additional plugins
  if ohai_plugin_count > 0
    # FIXME(log): figure out what the ohai logger looks like here
    ohai = Ohai::System.new.run_additional_plugins(Chef::Config[:ohai_segment_plugin_path])
    node.consume_ohai_data(ohai)
  end

  events.ohai_plugin_load_complete
end