diff options
author | Tim Smith <tsmith@chef.io> | 2018-10-26 14:43:02 -0700 |
---|---|---|
committer | Tim Smith <tsmith@chef.io> | 2018-10-26 14:43:02 -0700 |
commit | c33d6fe728ee0cf81cf35e21b5846f052ae02297 (patch) | |
tree | 1c4bce50cb2a49ab4ab36c18f0e53ac93c1820f6 | |
parent | 3759aeff5ff3c999fd99ffef44f6d00ad3fd0135 (diff) | |
download | ohai-refresh_plugins.tar.gz |
Removed unused refresh_plugins method in System classrefresh_plugins
We don't run this via Ohai or Chef anymore.
Signed-off-by: Tim Smith <tsmith@chef.io>
-rw-r--r-- | lib/ohai/system.rb | 17 | ||||
-rw-r--r-- | spec/unit/system_spec.rb | 67 |
2 files changed, 0 insertions, 84 deletions
diff --git a/lib/ohai/system.rb b/lib/ohai/system.rb index b6056d37..6c920408 100644 --- a/lib/ohai/system.rb +++ b/lib/ohai/system.rb @@ -139,23 +139,6 @@ module Ohai freeze_strings! end - # 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 - @provides_map.all_plugins(attribute_filter).each do |plugin| - plugin.reset! - end - run_plugins(true, attribute_filter) - end - # # Serialize this object as a hash # diff --git a/spec/unit/system_spec.rb b/spec/unit/system_spec.rb index a5b58232..3e704df3 100644 --- a/spec/unit/system_spec.rb +++ b/spec/unit/system_spec.rb @@ -305,73 +305,6 @@ EOF end end - describe "when refreshing plugins" do - when_plugins_directory "contains v7 plugins" do - with_plugin("desired.rb", <<-E) - Ohai.plugin(:DesiredPlugin) do - provides 'desired_attr' - depends 'depended_attr' - - collect_data do - desired_attr "hello" - self[:desired_attr_count] ||= 0 - self[:desired_attr_count] += 1 - end - end - E - - with_plugin("depended.rb", <<-E) - Ohai.plugin(:DependedPlugin) do - provides 'depended_attr' - - collect_data do - depended_attr "hello" - self[:depended_attr_count] ||= 0 - self[:depended_attr_count] += 1 - end - end - E - - with_plugin("other.rb", <<-E) - Ohai.plugin(:OtherPlugin) do - provides 'other_attr' - - collect_data do - other_attr "hello" - self[:other_attr_count] ||= 0 - self[:other_attr_count] += 1 - end - end - E - - before do - Ohai.config[:plugin_path] = [ path_to(".") ] - Ohai::Log.init(STDOUT) - Ohai::Log.level = :debug - ohai.all_plugins - end - - it "should rerun the plugin providing the desired attributes" do - expect(ohai.data[:desired_attr_count]).to eq(1) - ohai.refresh_plugins("desired_attr") - expect(ohai.data[:desired_attr_count]).to eq(2) - end - - it "should not re-run dependencies of the plugin providing the desired attributes" do - expect(ohai.data[:depended_attr_count]).to eq(1) - ohai.refresh_plugins("desired_attr") - expect(ohai.data[:depended_attr_count]).to eq(1) - end - - it "should not re-run plugins unrelated to the plugin providing the desired attributes" do - expect(ohai.data[:other_attr_count]).to eq(1) - ohai.refresh_plugins("desired_attr") - expect(ohai.data[:other_attr_count]).to eq(1) - end - - end - end - describe "when running ohai for specific attributes" do when_plugins_directory "contains v7 plugins" do with_plugin("languages.rb", <<-E) |