summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith@chef.io>2017-05-08 17:04:41 -0700
committerTim Smith <tsmith@chef.io>2017-05-08 17:04:41 -0700
commit7a8ee94b700c08498350b8c11dd60735db9564eb (patch)
tree01aafdaf9eac6c28d77e7a710240f8113634c45c
parent46f1f2443ce5d3f992e44506901dae6c114bb716 (diff)
downloadohai-7a8ee94b700c08498350b8c11dd60735db9564eb.tar.gz
Backport the additional plugin path logic from Ohai 13
This was done in 3 different PRs that reworked the entire config logic. Porting this back to 12 brings us 1 step closer to killing the ohai cookbook and fixes an enormous pain point for anyone trying to install their own Ohai plugins Signed-off-by: Tim Smith <tsmith@chef.io>
-rw-r--r--lib/ohai/config.rb2
-rw-r--r--lib/ohai/loader.rb2
-rw-r--r--spec/unit/loader_spec.rb2
3 files changed, 3 insertions, 3 deletions
diff --git a/lib/ohai/config.rb b/lib/ohai/config.rb
index f7e1f518..3722f848 100644
--- a/lib/ohai/config.rb
+++ b/lib/ohai/config.rb
@@ -47,7 +47,7 @@ module Ohai
end
def default_plugin_path
- [ File.expand_path(File.join(File.dirname(__FILE__), "plugins")) ]
+ [ File.expand_path(File.join(File.dirname(__FILE__), "plugins")), ChefConfig::Config.platform_specific_path("/etc/chef/ohai/plugins") ]
end
end
diff --git a/lib/ohai/loader.rb b/lib/ohai/loader.rb
index 0468a6de..8ecd3192 100644
--- a/lib/ohai/loader.rb
+++ b/lib/ohai/loader.rb
@@ -40,7 +40,7 @@ module Ohai
# Finds all the *.rb files under the configured paths in :plugin_path
def self.find_all_in(plugin_dir)
unless Dir.exist?(plugin_dir)
- Ohai::Log.warn("The plugin path #{plugin_dir} does not exist. Skipping...")
+ Ohai::Log.info("The plugin path #{plugin_dir} does not exist. Skipping...")
return []
end
diff --git a/spec/unit/loader_spec.rb b/spec/unit/loader_spec.rb
index bfe2aa83..7ee9bd1a 100644
--- a/spec/unit/loader_spec.rb
+++ b/spec/unit/loader_spec.rb
@@ -222,7 +222,7 @@ EOF
describe "when plugin directory does not exist" do
it "logs an invalid plugin path warning" do
- expect(Ohai::Log).to receive(:warn).with(/The plugin path.*does not exist/)
+ expect(Ohai::Log).to receive(:info).with(/The plugin path.*does not exist/)
allow(Dir).to receive(:exist?).with("/bogus/dir").and_return(false)
Ohai::Loader::PluginFile.find_all_in("/bogus/dir")
end