[chef] Re: Re: Re: Re: Variables in attributes file


Chronological Thread 
  • From: Jay Feldblum < >
  • To: " " < >
  • Subject: [chef] Re: Re: Re: Re: Variables in attributes file
  • Date: Tue, 10 Sep 2013 09:12:57 -0400

Carlton,

I also favor the approach of doing little or no logic in the attributes files.

However I typically avoid using normal-level attributes from a recipe and I also typically avoid saving the node explicitly in the middle of a chef run. I favor leaving normal-level attributes to the sysadmin's discretion and I favor letting the node be saved only at the end of a successful converge. This avoids any problems such as the run failing after the first explicit save but before the final save, leaving the node data in an inconsistent state.

Cheers,
Jay Feldblum

On Tue, Sep 10, 2013 at 8:03 AM, Carlton Stedman < " target="_blank"> > wrote:
The attributes files are just rb, so logic could be put in there.

However, as a best practice, I generally do little/no logic in the attributes files, treating them more as strict data. I would generate derived node attributes (using node.set/node.save as in above ruby_block) in recipes.

The reason for this is if I override an attribute in a wrapper cookbook, then I don't want to have to put the logic in the wrapper cookbook, just override an attribute and have the base (wrapped) cookbook do the logic using the overridden attribute.



Archive powered by MHonArc 2.6.16.

§