def require_plugin(plugin_ref, force=false)
plugins = [ ]
if @v6_dependency_solver.has_key? pathify_v6_plugin(plugin_ref)
plugins << @v6_dependency_solver[pathify_v6_plugin(plugin_ref)]
else
attribute = plugin_ref.gsub("::", "/")
begin
plugins = @provides_map.find_providers_for([attribute])
rescue Ohai::Exceptions::AttributeNotFound
Ohai::Log.debug("Can not find any v7 plugin that provides #{attribute}")
plugins = [ ]
end
end
if plugins.empty?
raise Ohai::Exceptions::DependencyNotFound, "Can not find a plugin for dependency #{plugin_ref}"
else
plugins.each do |plugin|
begin
@runner.run_plugin(plugin)
rescue SystemExit, Interrupt
raise
rescue Ohai::Exceptions::DependencyCycle, Ohai::Exceptions::AttributeNotFound => e
Ohai::Log.error("Encountered error while running plugins: #{e.inspect}")
raise
rescue Exception,Errno::ENOENT => e
Ohai::Log.debug("Plugin #{plugin.name} threw exception #{e.inspect} #{e.backtrace.join("\n")}")
end
end
end
end