summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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