How to determine the target of a chef variable



here is my problem. I have different provider for many cookbooks and a lot of way to make cookbooks.
I have for each cookbook attributes list and I would like to know AUTOMATICALY the target file that will be changed on the target server. Is it possible and how to ?

for exemple Inside the chef apache2 package there’s an attributed called :slight_smile:

finally threadlimit will be put in an apache2.conf or httpd.conf file but maybe with a different name.

what is the way (maybe with knife command or something like that) to determine the target file for each attributes?



And I’d like a pony. This class of problem is similar to knowing if a computer program will terminate, in a way that can itself run as a computer program. Such programs are called “NP hard” for a reason.

In practice, this is mostly resolved by following a well defined workflow. You can review the results of deployed or modified files in /var/chef/backup/ when files are changed. And associated tasks, such as sets of recipes and attributes bundled for a class of server, are bundled into a well defined role or wrapper cookbook. But until and unless chef programmers are consistent about the names of target files versus the recipes and templates that pupulate them, and until or unless chef gets some kind of “dry-run” capability, I think you’re out of luck.


I understand what you write (with my poor english).
It’s a true problem this inconsistence because in fact it’s very hard to control what is modified exactly at the end withour debuging each cookbook. Something missing in chef I think. It’s difficult because sometimes (often) some project cookbook of a provider needs some others third party cookbook and at the end It’s a difficult to understand what move, and it’s hard to debug a problem on a target server.
My idea at the moment (but it’s a workaround) is to capture all rpms installed, for each one to list all conf, xml ,cfg files and make a md5 of all conf file on the server to compare between many ‘identical’ servers to be sure there are “identical”. It’s a sort of rewriting tool like Tripwire for Chef :frowning:


This is where testing your cookbooks and workflow help. Using kitchen,
inspec, chefspec etc. Then creating images using tools like packer from
your cookbooks.