Yes true, good point - the attributes (that you want to change) in wrappers would be a different cookbook name. It wouldn’t make sense to use the method in that case.
From: Jeff Byrnes
Reply-To: " " target="_blank"> "
Date: Wednesday, March 18, 2015 at 8:26 AM
To: " " target="_blank"> "
Subject: [chef] Re: Using cookbook_name method in cookbooks
Speculation on my part, but in the context of wrapping a cookbook, wouldn’t the cookbook_name variable become the name of the wrapper cookbook, not the cookbook that the attribute(s) belong to?
On March 18, 2015 at 8:23:21 AM, Cliff Pracht ( " target="_blank"> ) wrote:
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 directorydefault['apache']['run_dir'] = '/var/run/httpd'
Instead of this:
#default apache run directorydefault[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.