[chef] Re: Re: CHEF-3580: Do you keep node artifacts in source control?


Chronological Thread 
  • From: Daniel DeLeo < >
  • To:
  • Subject: [chef] Re: Re: CHEF-3580: Do you keep node artifacts in source control?
  • Date: Sat, 3 Nov 2012 17:31:00 -0700


On Saturday, November 3, 2012 at 4:45 PM, Andrea Campi wrote:



On Fri, Nov 2, 2012 at 6:11 PM, Bryan McLellan < " target="_blank"> > wrote:
What goes in them? Anything more than a run list? What attribute
precedence are you using?

We do keep nodes in git.
We use https://github.com/andreacampi/knife-export-plugins to dump nodes; that takes care of keeping things predictable enough that a diff is meaningful.

My only gripe with this are the cookbooks that needlessly set normal attributes… If we could reduce those to the bare minimum, I'd be a happy camper.
 

If the node exists, would you prefer 'knife node from file' to:
1) fail
2) overwrite the node (all attributes)
3) overwrite the node, then expand the run list
4) merge with the existing node

(Current result is #2)

Why?

What if you weren't as smart and awesome as you are today?

I'm not sure I understand #3… fully expanding the run list, i.e. saving to the node the list of recipes that happen to appear on the run list, if we were to expand roles right now?
That doesn't sound terribly useful, it will be out of date as soon as any role is edited.
But I'm probably wrong and you meant something else.
There's some context missing here. In Chef 11, Node objects internally store default and override attributes from roles and environments separately from attributes from cookbooks. These attributes are applied when the run_list is expanded (`Node#expand!`). Therefore, it's possible for knife, when creating or editing a node, to expand the run_list, setting the automatic node[:roles] and node[:recipes] attributes along with the attributes sourced from roles and environments. In the case of editing a node, attributes from cookbooks would be lost until you run chef-client on that node.

This could be combined with option #4, so that normal attributes and automatic attributes on the node are retained, but default and override are replaced.

Side note, a longer post on the attribute changes I described will be coming next week sometime.
 


I don't have a strong preference one way or another, but:

#2 is convenient if you are very rigorous in your workflow. If you are not, you may well end up losing attributes.
Also, it doesn't really play well with cookbooks that set normal attribute *unless* you make sure to commit those (like I do).

I feel like #4 is probably more newbie-friendly.



-- 
Daniel DeLeo




Archive powered by MHonArc 2.6.16.

§