lib/ohai/dsl/plugin/versionvii.rb in ohai-15.1.5 vs lib/ohai/dsl/plugin/versionvii.rb in ohai-15.2.5
- old
+ new
@@ -143,13 +143,15 @@
logger.warn("[UNSUPPORTED OPERATION] \'require_plugin\' is no longer supported. Please use \'depends\' instead.\nIgnoring plugin(s) #{args.join(", ")}")
end
def configuration(option, *options)
return nil if plugin_config.nil? || !plugin_config.key?(option)
+
value = plugin_config[option]
options.each do |opt|
return nil unless value.key?(opt)
+
value = value[opt]
end
value
end
@@ -167,15 +169,15 @@
parts = name.to_s.split(/([A-Z][a-z]+)/)
# ["DMI"] => ["DMI"]
# ["", "Memory"] => ["Memory"]
# ["", "Network", "", "Listeners"] => ["Network", "Listeners"]
# ["SSH", "Host", "", "Key"] => ["SSH", "Host", "Key"]
- parts.delete_if { |part| part.empty? }
+ parts.delete_if(&:empty?)
# ["DMI"] => :dmi
# ["Memory"] => :memory
# ["Network", "Listeners"] => :network_listeners
# ["SSH", "Host", "Key"] => :ssh_host_key
- snake_case_name = parts.map { |part| part.downcase }.join("_").to_sym
+ snake_case_name = parts.map(&:downcase).join("_").to_sym
# Plugin names in config hashes are auto-vivified, so we check with
# key? to avoid falsely instantiating a configuration hash.
if Ohai.config[:plugin].key?(snake_case_name)
Ohai.config[:plugin][snake_case_name]