Pre-load idea

I have the seed of an idea and was wondering if this is possible to hook
into from the current chef code.

Now that there is the implementation of why-run, (and this could apply even
before this) would it be possible to hook into chef at run compilation time
and dump out all the attributes that would be set during a run?

I’m thinking of an idea even prior to why-run.

Suppose you have a run_list; I can see a scenario where I would like to
load all recipes in a run_list and dump out all the attributes that would
be set in the run - including their priority from overrides. This would
allow a sanity check of new config that could be applied, but equally allow
you to see what attributes you may have missed from a cookbook that might
need setting/overriding.

I’ve been stung by this behaviour a few times recently when a change had
been made that propagated to our release branch and a sanity check would
have helped.

Clearly there is good logic within Chef that calculates the attribute
precedence and I wouldn’t want to rewrite this. Could I hook into Chef
somehow and grab the compiled run to deliver me all set attributes?

I appreciate there are cases where search against databags or infra occur
during a run that may change set attributes, but I think I will disregard
that on first pass.

Ideas, comments welcome.

Tom

On Thursday, September 27, 2012 at 4:10 PM, Tom wrote:

I have the seed of an idea and was wondering if this is possible to hook into from the current chef code.

Now that there is the implementation of why-run, (and this could apply even before this) would it be possible to hook into chef at run compilation time and dump out all the attributes that would be set during a run?

I'm thinking of an idea even prior to why-run.

Suppose you have a run_list; I can see a scenario where I would like to load all recipes in a run_list and dump out all the attributes that would be set in the run - including their priority from overrides. This would allow a sanity check of new config that could be applied, but equally allow you to see what attributes you may have missed from a cookbook that might need setting/overriding.

I've been stung by this behaviour a few times recently when a change had been made that propagated to our release branch and a sanity check would have helped.

Clearly there is good logic within Chef that calculates the attribute precedence and I wouldn't want to rewrite this. Could I hook into Chef somehow and grab the compiled run to deliver me all set attributes?

I appreciate there are cases where search against databags or infra occur during a run that may change set attributes, but I think I will disregard that on first pass.

Ideas, comments welcome.

Tom

Not exactly what you describe, but I once wrote a knife exec script to compile the resource collection and print the "compiled" resources (like you see in the error inspector when a resource fails to converge). I haven't updated it recently, so I don't know that it still works with Chef 10.14.x, YMMV, etc.

--
Daniel DeLeo