diff options
author | Claire McQuin <claire@opscode.com> | 2013-09-25 13:31:10 -0700 |
---|---|---|
committer | Claire McQuin <claire@opscode.com> | 2013-10-17 12:07:30 -0700 |
commit | 74a2489a2bcc75ac4675f93b9f23e6b913b1d53d (patch) | |
tree | d85d3634127918bf06f2f68e077e7bd9d262fcf4 /lib/ohai | |
parent | 076e4293393b948b9e9c3ff1719a53b6c5d65058 (diff) | |
download | ohai-74a2489a2bcc75ac4675f93b9f23e6b913b1d53d.tar.gz |
modify system, loader for plugin naming
Diffstat (limited to 'lib/ohai')
-rw-r--r-- | lib/ohai/dsl/plugin.rb | 4 | ||||
-rw-r--r-- | lib/ohai/loader.rb | 6 | ||||
-rw-r--r-- | lib/ohai/system.rb | 4 |
3 files changed, 9 insertions, 5 deletions
diff --git a/lib/ohai/dsl/plugin.rb b/lib/ohai/dsl/plugin.rb index 9426e3c8..9b628df8 100644 --- a/lib/ohai/dsl/plugin.rb +++ b/lib/ohai/dsl/plugin.rb @@ -20,6 +20,8 @@ # @todo: move os to mixin require 'ohai/os' +require 'ohai/mixin/command' +require 'ohai/mixin/seconds_to_human' module Ohai @@ -166,7 +168,7 @@ module Ohai if data_collector.has_key?(plat) Ohai::Log.warn("Already defined collect_data on platform #{plat}") else - collector[plat] = block + data_collector[plat] = block end end end diff --git a/lib/ohai/loader.rb b/lib/ohai/loader.rb index 249b04fe..df97bced 100644 --- a/lib/ohai/loader.rb +++ b/lib/ohai/loader.rb @@ -28,7 +28,9 @@ module Ohai @attributes = controller.attributes end - def load_plugin(plugin_path) + # @note: plugin_name is used only by version 6 plugins and is the + # unique part of the file name from Ohai::Config[:plugin_path] + def load_plugin(plugin_path, plugin_name) plugin = nil contents = "" @@ -55,7 +57,7 @@ module Ohai collect_provides(plugin) else Ohai::Log.warn("[DEPRECATION] Plugin at #{plugin_path} is a version 6 plugin. Version 6 plugins will not be supported in future releases of Ohai. Please upgrage your plugin to version 7 plugin syntax. For more information visit here: XXX") - klass = Ohai.v6plugin { collect_contents(contents) } + klass = Ohai.v6plugin(plugin_name) { collect_contents(contents) } plugin = klass.new(@controller, plugin_path) end diff --git a/lib/ohai/system.rb b/lib/ohai/system.rb index 13279c12..ee506de2 100644 --- a/lib/ohai/system.rb +++ b/lib/ohai/system.rb @@ -62,7 +62,7 @@ module Ohai if md plugin_name = md[1].gsub(File::SEPARATOR, "::") unless @v6_dependency_solver.has_key?(plugin_name) - plugin = @loader.load_plugin(file) + plugin = @loader.load_plugin(file, plugin_name) @v6_dependency_solver[plugin_name] = plugin unless plugin.nil? else Ohai::Log.debug("Already loaded plugin at #{file}") @@ -178,7 +178,7 @@ module Ohai Ohai::Config[:plugin_path].each do |path| check_path = File.expand_path(File.join(path, filename)) if File.exist?(check_path) - plugin = @loader.load_plugin(check_path) + plugin = @loader.load_plugin(check_path, plugin_name) @v6_dependency_solver[plugin_name] = plugin break else |