[chef] Environment attributes in Cookbooks.


Chronological Thread 
  • From: Douglas Garstang < >
  • To:
  • Subject: [chef] Environment attributes in Cookbooks.
  • Date: Fri, 19 Jun 2015 07:22:43 -0700

If I was going to put move my environmental attributes into cookbooks...

When deployed to an instance, the top level run list would need to include the environmental run list. That's ok.

However, when testing, this would mean that each cookbook would need to either include the environment cookbook (ie #include_recipe "env-dev") and refer to it in the metadata.rb and Berksfile files, OR I'd have to specifically put each attribute into the Vagrantfile's json data.

This might work for simple cookbooks, but it would mean the cookbook is not being effectively tested. The attributes I'm testing against aren't what really gets deployed to an instance. I also have to maintain two copies of the attributes and the worst case scenario is where the attribute is set in both places but the value in the Vagranrfile is incorrect and therefore leads to the incorrect assumption that the cookbook is working correctly.

For my base cookbook it gets even worse. It would need to have every single attribute from every cookbook it includes put into the Vagrantfile's json data. This just does not scale.

It doesn't seem like the benefits of gaining some revision control outweigh the maintenance disadvantages here. For all those that espouse the use of putting environment attributes into a cookbook how do you get around this?

Doug



Archive powered by MHonArc 2.6.16.

§