Hi Jeremiah!
On Fri, Apr 20, 2012 at 2:05 PM, Jeremiah Snapp
jeremiah.snapp@gmail.com wrote:
I created a chef-repo and documentation that should make it very easy to
demonstrate the power of using Chef, Librarian and Vagrant together for
iterative infrastructure building and testing.
I hope this is helpful even to those who aren't necessarily new to Chef
since one of the primary reasons I created this is to demonstrate how I
manage cookbooks using Librarian.
I've made some choices that are a little different than the wikis recommend
but it has really helped me be able to decouple cookbooks from my chef-repo
and more easily be able to contribute back to the community.
This is really cool, I was just tooling around with a similar approach
for my own personal Chef Repository! Jay is doing a great job with
Librarian.
Regarding this in the "Chef Cookbook Management" page:
"It used to be recommended that we customize cookbooks' templates,
files, recipes, etc by expecting knife cookbook upload to merge
multiple cookbook paths set in knife.rb cookbook_path (e.g. cookbooks,
site-cookbooks) but that is being deprecated."
I'd like to clarify what is being deprecated here.
The ability to have both a "cookbooks" and "site-cookbooks" (or
vendor-cookbooks, or whatever you want to name it) is not being
deprecated[0]. The ability to override a specific cookbook by
"shadowing" components in a second directory is deprecated[1]. To
illustrate with an example, suppose you had this your cookbook_path:
cookbook_path ["./cookbooks", "./site-cookbooks"]
And then you downloaded Opscode's chef-client cookbook:
> ls cookbooks/chef-client
cookbooks/chef-client/* contents printed
But you want to modify the client.rb config file and put it in site-cookbooks:
> tree site-cookbooks/chef-client
site-cookbooks/chef-client
└── templates
└── default
└── client.rb.erb
When uploading the chef-client cookbook, you'll get a deprecation
warning, which will be printed for each cookbook that exists in both
directories:
> knife cookbook upload chef-client
WARNING: * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
WARNING: The cookbooks: chef-client exist in multiple places in
your cookbook_path.
A composite version of these cookbooks has been compiled for uploading.
IMPORTANT: In a future version of Chef, this behavior will be
removed and you will no longer
be able to have the same version of a cookbook in multiple places
in your cookbook_path.
WARNING: The affected cookbooks are located:
chef-client:
/home/jtimberman/tmp/c/cookbooks/chef-client
/home/jtimberman/tmp/c/site-cookbooks/chef-client
WARNING: * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
Uploading chef-client [1.1.2]
Uploaded 1 cookbook.
It does upload fine because this hasn't been completely deprecated
(i.e., removed).
However, if you simply wanted to make your own "site specific"
cookbook in the site-cookbooks directory and it didn't overlap with
one in cookbooks, then it will be as normal:
> mkdir -p site-cookbooks/normal-things/recipes
> touch site-cookbooks/normal-things/recipes/default.rb
> knife cookbook upload normal-things
Uploading normal-things [0.0.1]
Uploaded 1 cookbook.
TL;DR: you can have multiple directories in your cookbook_path and
that's fine as long as you don't duplicate a cookbook between them,
then you'll see the warning.
[0]: unless someone decided that and didn't tell me :-).
[1]: http://tickets.opscode.com/browse/CHEF-2308
--
Opscode, Inc
Joshua Timberman, Technical Program Manager
IRC, Skype, Twitter, Github: jtimberman