[chef] Re: Re: Re: Re: Puppet+Hiera vs. Chef, or handling the occasional special snowflake server


Chronological Thread 
  • From: Lamont Granquist < >
  • To:
  • Subject: [chef] Re: Re: Re: Re: Puppet+Hiera vs. Chef, or handling the occasional special snowflake server
  • Date: Thu, 08 Oct 2015 00:00:36 -0700



On 10/07/2015 08:39 AM, Daniel DeLeo wrote:
Attributes at the “normal” level belong to the node and are NOT wiped for each run. All of the other levels belong to an external thing (role, environment, policyfile) so they are wiped and recreated.

Note that tags are implemented as normal attributes so they are easy ways to use normal attributes and have a nice understandable API, where you expect them to persist and generally expect one-offs to occur and have a nice 'knife tag' command line API to use.

In general, normal attributes cause all kinds of issues when people use them to set attributes from cookbooks. Since normal attributes do persist and don't get cleared once they're set in a cookbook they're set on the node. That can be confusing when you delete the line from the cookbook which set the normal attribute and then expect the setting to be gone in the next run but its not. For that reason we generally discourage their use. It can be very confusing to have a chef-client run behaving some way and you look through the cookbooks and roles and it simply "cant" be doing that, but then you 'knife node show' and discover a normal attribute that someone set on the node.

It is particularly bad that normal attributes came first and 'node.set' is a kind of obvious API to use to set attributes, but which sets a 'normal' attribute. And the word 'normal' sounds like the kind of thing that's not bad to use -- but generally it is.

However, for one-offs and tags they're fine. You can also 'tag' nodes with a role that sets the attributes (or a role-cookbook or role-with-cookbook-that-acts-like-role-cookbook) and that way you can easily see that kind of 'tag' on the run_list. Might create clutter on the run_list, but that's generally going to be a more flexible approach than tags and you don't risk any normal-attributes confusion (again though the run_list itself is a normal attribute, so you're using them under the covers, but in a way that you've been trained to expect their behavior).




Archive powered by MHonArc 2.6.16.

§