class Chef::Resource::OhaiHint

Public Instance Methods

after_created() click to toggle source

this resource forces itself to run at compile_time

@return [void]

# File lib/chef/resource/ohai_hint.rb, line 89
def after_created
  return unless compile_time
  Array(action).each do |action|
    run_action(action)
  end
end
format_content(content) click to toggle source

format content hash as JSON @param content [Hash] the content of the hint file @return [JSON] json representation of the content of an empty string if content was nil

# File lib/chef/resource/ohai_hint.rb, line 80
def format_content(content)
  return "" if content.nil? || content.empty?
  JSON.pretty_generate(content)
end
ohai_hint_file_path(filename) click to toggle source

given a hint filename return the platform specific hint file path @param filename [String] the name of the hint file @return [String] absolute path to the file

# File lib/chef/resource/ohai_hint.rb, line 71
def ohai_hint_file_path(filename)
  path = ::File.join(::Ohai::Config.ohai.hints_path.first, filename)
  path << ".json" unless path.end_with?(".json")
  path
end