lib/onering/plugins/reporter.rb in onering-client-0.0.85 vs lib/onering/plugins/reporter.rb in onering-client-0.0.86

- old
+ new

@@ -54,11 +54,11 @@ rescue LoadError Onering::Logger.error("Unable to load Facter library", "Onering::Reporter") end end - def load_plugins + def load_plugins() # load plugins from @path @path.compact.each do |root| begin Dir["#{root}/*"].each do |directory| @@ -69,19 +69,19 @@ # allow plugins to be conditionally loaded based on fact values: # default - always load # <fact>-<fact_value> - load if <fact> == <fact_value> # if d == 'default' or Facter.value(d.split('-',2).first).to_s.downcase.nil_empty == d.split('-',2).last.to_s.downcase.nil_empty - Dir[File.join(directory, '*.rb')].each do |e| - e = File.basename(e, '.rb') + Dir[File.join(directory, '*.rb')].each do |plugin| + plugin = File.basename(plugin, '.rb') begin Timeout.timeout((@options[:plugin_timeout] || 10).to_i) do - Onering::Logger.debug("Loading plugin #{e}", "Onering::Reporter") - require "#{directory}/#{e}" + Onering::Logger.debug("Loading plugin #{plugin}", "Onering::Reporter") + require "#{directory}/#{plugin}" end - rescue Timeout::Error - Onering::Logger.warn("Plugin #{e} took too long to return, skipping", "Onering::Reporter") + rescue Timeout::Error => e + Onering::Logger.warn("Plugin #{plugin} took too long to return, skipping", "Onering::Reporter") end end end end end