summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Keiser <john@johnkeiser.com>2016-03-09 12:24:40 -0800
committerJohn Keiser <john@johnkeiser.com>2016-03-09 12:56:08 -0800
commit1d260ee08afe09bd4d53abd81c9d7ab1dda48a16 (patch)
tree33a1981bdec4431908044de784627f542645b7ed
parent94a20df0d6ba5e6ac008850baf87c0d9098f2dba (diff)
downloadohai-jk/chef-12.7.tar.gz
Make ohai work with Chef 12.7 and belowjk/chef-12.7
-rw-r--r--lib/ohai/loader.rb8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/ohai/loader.rb b/lib/ohai/loader.rb
index 0328b59e..f5c37607 100644
--- a/lib/ohai/loader.rb
+++ b/lib/ohai/loader.rb
@@ -39,7 +39,13 @@ module Ohai
# Finds all the *.rb files under the configured paths in :plugin_path
def self.find_all_in(plugin_dir)
- Dir[File.join(ChefConfig::PathHelper.escape_glob_dir(plugin_dir), "**", "*.rb")].map do |file|
+ # escape_glob_dir does not exist in 12.7 or below
+ if ChefConfig::PathHelper.respond_to?(:escape_glob_dir)
+ escaped = ChefConfig::PathHelper.escape_glob_dir(plugin_dir)
+ else
+ escaped = ChefConfig::PathHelper.escape_glob(plugin_dir)
+ end
+ Dir[File.join(escaped, "**", "*.rb")].map do |file|
new(file, plugin_dir)
end
end