[chef] Re: Attribute Names


Chronological Thread 
  • From: Daniel DeLeo < >
  • To:
  • Cc:
  • Subject: [chef] Re: Attribute Names
  • Date: Wed, 20 Mar 2013 17:01:10 -0700


On Wednesday, March 20, 2013 at 4:56 PM, Matthew Sims wrote:


I'm mostly curious how others handle this.

We have a chef environment where attribute can be located in three
places;the cookbook attributes, environments and roles (and in some cases,
in other cookbooks.)

Having to figure out where an attribute is set is occasionally frustrating
when I have to search in several places.

An idea proposed was the have the taxonomy of the attribute define where
it is being set.

Example:
['example']['attr']['value'] if set in the cookbook's attributes.
['example']['env']['value'] if set in the environments.
['example']['node']['value'] if set in the node.

I understand this breaks the precedence structure of attributes as we now
having unique attribute names based on location.

But having to find where the attribute is set can be a bit tedious.

I'm curious how others handle this. What method do you use so that looking
at an attribute in a cookbook, they know where to go find it rather than
search for it.

--
Matthew Sims
At the last minute before shipping Chef 11, I added some debugging code I was using to chef core. It's only useful during a chef run, but hopefully you find it helpful.

Synopsis:

# Recipe:
require 'pp'
pp node.debug_value(:test, :source)

# Output:
[["set_unless_enabled?", false],
 ["default", "attributes default"],
 ["env_default", :not_present],
 ["role_default", "role default"],
 ["force_default", :not_present],
 ["normal", "attributes normal"],
 ["override", "attributes override"],
 ["role_override", "role override"],
 ["env_override", :not_present],
 ["force_override", :not_present],
 ["automatic", :not_present]]

More info:

Read http://www.opscode.com/blog/2013/02/05/chef-11-in-depth-attributes-changes/ and scroll to the "debugging attributes" section.

HTH,

-- 
Daniel DeLeo




Archive powered by MHonArc 2.6.16.

§