[chef] Using cookbook_name method in cookbooks


Chronological Thread 
  • From: Cliff Pracht < >
  • To: " " < >
  • Subject: [chef] Using cookbook_name method in cookbooks
  • Date: Wed, 18 Mar 2015 12:23:06 +0000
  • Accept-language: en-US

Hi all,

I’ve noticed in a lot of cookbook code when needing the cookbook name, folks have been using the hard coded string name.

Eg. In the apache cookbook a defined attribute looks something like this where ‘apache’ is listed 100s of times:

#default apache run directory 
 default['apache']['run_dir'] = '/var/run/httpd'

Instead of this:

#default apache run directory 
 default[cookbook_name]['run_dir']  = '/var/run/httpd

Obviously, changing a cookbook name is not an everyday thing.   However we have a strict naming convention at our shop for cookbooks to clarify the purpose of cookbook (eg. whether the cookbook is a library, wrapper, policy, operating system, etc.).  And have had to change the name frequently initially to get right. 

Any thoughts on doing this?  Are there drawbacks with this?

Thanks,

Cliff







Archive powered by MHonArc 2.6.16.

§