Class/Module Index [+]

Quicksearch

Chef::Mixin::LanguageIncludeAttribute

Public Instance Methods

include_attribute(*fully_qualified_attribute_short_filenames) click to toggle source

Loads the attribute file specified by the short name of the file, e.g., loads specified cookbook's

"attributes/mailservers.rb"

if passed

"mailservers"
# File lib/chef/mixin/language_include_attribute.rb, line 30
def include_attribute(*fully_qualified_attribute_short_filenames)
  if self.kind_of?(Chef::Node)
    node = self
  else
    node = @node
  end

  fully_qualified_attribute_short_filenames.flatten.each do |fully_qualified_attribute_short_filename|
    if node.run_state[:seen_attributes].has_key?(fully_qualified_attribute_short_filename)
      Chef::Log.debug("I am not loading attribute file #{fully_qualified_attribute_short_filename}, because I have already seen it.")
      next
    end

    Chef::Log.debug("Loading Attribute #{fully_qualified_attribute_short_filename}")
    node.run_state[:seen_attributes][fully_qualified_attribute_short_filename] = true

    if amatch = fully_qualified_attribute_short_filename.match(/(.+?)::(.+)/)
      cookbook_name = amatch[1].to_sym
      node.load_attribute_by_short_filename(amatch[2], cookbook_name)
    else
      cookbook_name = fully_qualified_attribute_short_filename.to_sym
      node.load_attribute_by_short_filename("default", cookbook_name)
    end
  end
  true
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.