def require_plugin(plugin_name, force=false)
unless force
return true if @seen_plugins[plugin_name]
end
if Ohai::Config[:disabled_plugins].include?(plugin_name)
Ohai::Log.debug("Skipping disabled plugin #{plugin_name}")
return false
end
@plugin_path = plugin_name
filename = "#{plugin_name.gsub("::", File::SEPARATOR)}.rb"
Ohai::Config[:plugin_path].each do |path|
check_path = File.expand_path(File.join(path, filename))
begin
@seen_plugins[plugin_name] = true
Ohai::Log.debug("Loading plugin #{plugin_name}")
from_file(check_path)
return true
rescue Errno::ENOENT => e
Ohai::Log.debug("No #{plugin_name} at #{check_path}")
rescue SystemExit, Interrupt
raise
rescue Exception,Errno::ENOENT => e
Ohai::Log.debug("Plugin #{plugin_name} threw exception #{e.inspect} #{e.backtrace.join("\n")}")
end
end
end