summaryrefslogtreecommitdiff
path: root/lib/ohai/system.rb
diff options
context:
space:
mode:
authordanielsdeleo <dan@opscode.com>2014-01-06 16:43:11 -0800
committerdanielsdeleo <dan@opscode.com>2014-01-09 13:35:28 -0800
commit20389f1ca130fbde8c6e6be70803a443a4bead54 (patch)
tree15f028b32c7c979c49239d8ebdf2fd9762e4cf89 /lib/ohai/system.rb
parent90988200ccb18d8e68e5467777bcf5112eb65f03 (diff)
downloadohai-20389f1ca130fbde8c6e6be70803a443a4bead54.tar.gz
Update refresh plugin logic for 7.0 architecture
Diffstat (limited to 'lib/ohai/system.rb')
-rw-r--r--lib/ohai/system.rb37
1 files changed, 13 insertions, 24 deletions
diff --git a/lib/ohai/system.rb b/lib/ohai/system.rb
index 476586e9..0c3d7d76 100644
--- a/lib/ohai/system.rb
+++ b/lib/ohai/system.rb
@@ -127,32 +127,21 @@ module Ohai
end
end
- # TODO: fix for running w/new internals
- # add updated function to v7?
- def refresh_plugins(path = '/')
+ # Re-runs plugins that provide the attributes specified by
+ # +attribute_filter+. If +attribute_filter+ is not given, re-runs all
+ # plugins.
+ #
+ # Note that dependencies will not be re-run, so you must specify all of the
+ # attributes you want refreshed in the +attribute_filter+
+ #
+ # This method takes a naive approach to v6 plugins: it simply re-runs all
+ # of them whenever called.
+ def refresh_plugins(attribute_filter=nil)
Ohai::Hints.refresh_hints()
-
- parts = path.split('/')
- if parts.length == 0
- h = @metadata
- else
- parts.shift if parts[0].length == 0
- h = @metadata
- parts.each do |part|
- break unless h.has_key?(part)
- h = h[part]
- end
- end
-
- refreshments = collect_plugins(h)
- Ohai::Log.debug("Refreshing plugins: #{refreshments.join(", ")}")
-
- refreshments.each do |r|
- @seen_plugins.delete(r) if @seen_plugins.has_key?(r)
- end
- refreshments.each do |r|
- require_plugin(r) unless @seen_plugins.has_key?(r)
+ @provides_map.all_plugins(Array(attribute_filter)).each do |plugin|
+ plugin.reset!
end
+ run_plugins(true, false, Array(attribute_filter))
end
#