diff options
author | John Keiser <john@johnkeiser.com> | 2016-03-09 12:24:40 -0800 |
---|---|---|
committer | John Keiser <john@johnkeiser.com> | 2016-03-09 12:56:08 -0800 |
commit | 1d260ee08afe09bd4d53abd81c9d7ab1dda48a16 (patch) | |
tree | 33a1981bdec4431908044de784627f542645b7ed | |
parent | 94a20df0d6ba5e6ac008850baf87c0d9098f2dba (diff) | |
download | ohai-1d260ee08afe09bd4d53abd81c9d7ab1dda48a16.tar.gz |
Make ohai work with Chef 12.7 and belowjk/chef-12.7
-rw-r--r-- | lib/ohai/loader.rb | 8 |
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 |