lib/ohai/system.rb in ohai-15.1.5 vs lib/ohai/system.rb in ohai-15.2.5

- old
+ new

@@ -82,10 +82,11 @@ # Resets the system and loads then runs the plugins. This is the primary method called # to run the system. # # @param [Array<String>] attribute_filter the attributes to run. All will be run if not specified + # # @return [void] def all_plugins(attribute_filter = nil) # Reset the system when all_plugins is called since this function # can be run multiple times in order to pick up any changes in the # config or plugins with Chef. @@ -94,10 +95,11 @@ load_plugins run_plugins(true, attribute_filter) end # load all plugins by calling Ohai::Loader.load_all + # # @see Ohai::Loader.load_all def load_plugins @loader.load_all end @@ -129,10 +131,14 @@ # Freeze all strings. freeze_strings! end + # @param [String] plugin_path + # + # @return [void] + # def run_additional_plugins(plugin_path) @loader.load_additional(plugin_path).each do |plugin| logger.trace "Running plugin #{plugin}" @runner.run_plugin(plugin) end @@ -158,10 +164,11 @@ data = @data a.split("/").each do |part| data = data[part] end raise ArgumentError, "I cannot find an attribute named #{a}!" if data.nil? + case data when Hash, Mash, Array, Integer json_pretty_print(data) when String if data.respond_to?(:lines) @@ -182,9 +189,10 @@ # add any additional CLI passed directories to the plugin path excluding duplicates unless Ohai.config[:directory].nil? # make sure the directory config is an array since it could be a string set in client.rb Array(Ohai.config[:directory]).each do |dir| next if Ohai.config[:plugin_path].include?(dir) + Ohai.config[:plugin_path] << dir end end logger.debug("Running Ohai with the following configuration: #{Ohai.config.configuration}")