[chef] Re: Re: Re: Demonstrating the Power of Chef, Librarian and Vagrant

Chronological Thread 
  • From: Jeremiah Snapp < >
  • To:
  • Subject: [chef] Re: Re: Re: Demonstrating the Power of Chef, Librarian and Vagrant
  • Date: Sun, 22 Apr 2012 00:43:00 -0400

On Sat, Apr 21, 2012 at 6:06 AM, Bryan Berry < " target="_blank"> > wrote:
nice writeup Jeremiah!

Thanks Bryan.  I'm glad to have something to contribute to this community.  Working with Chef has really brought some joy back into my work which is a nice change.
When you add a new cookbook to your repository, do you just git clone
it into site-cookbooks/  ?

I prefer not to have git repos inside my chef-repo.  
Either I'm just not daring enough to mess with nested git repos or I'm smart enough to avoid them. :)

If I'm going to clone any cookbooks then I clone them to a different cookbooks directory just outside my chef-repo.

So it looks like this.
   └── cookbooks                       <--- git cloned vendor or personal cookbooks I want to modify
                                                        use ':path' in Librarian Cheffile so these get put into chef-repo/cookbooks
   └── chef-repo
          └── cookbooks                <--- Librarian managed directory; never touch or modify the cookbooks here
          └── site-cookbooks          <--- rare personal cookbooks that I don't want to track in individual git repos

I rarely use my site-cookbooks directory.  It's reserved for cookbooks that more than likely no one else would benefit from.  Cookbooks that are specific to my infrastructure that I don't want/need to track in individual git repos.

I found that if I modified a cookbook in cookbooks/ the change would
not be reflected on upload as librarian actually uploaded the same
cookbook stored under chef-repo/temp/librarian/.../<cookbook-hash>
rather than the one stored in chef-repo/cookbooks which I presume is
put there for easy referencing.

It sounds like you chose to integrate knife and librarian as is recommended in librarian's documentation.  So what you are experiencing is expected.  When they are integrated knife actually doesn't upload cookbooks from the cookbooks path but instead uses librarian to directly provide whatever you defined in librarian's Cheffile.  So by design you will get what you asked librarian to provide even if you modify what librarian put in your chef-repo/cookbooks directory.

I chose not to integrate knife and librarian simply because I didn't like how knife commands were completely broken unless they were run in the same folder that contains the librarian Cheffile.  I don't personally see any compelling reason for integration as long as I am willing to be responsible for making sure my chef-repo/cookbooks directory has what is defined in Cheffile by running 'librarian-chef clean && librarian-chef install'.
Since you source your site-cookbooks/ in your Cheffile using :path,
does librarian also keep an additional copy of each cookbook in
site-cookbooks/ or only one?

No.  I hope my use of the word "source" isn't confusing things.  I was simply using it because that's what Librarian's documentation uses and it seems to make sense.  Source just refers to the home location of a cookbook.  Use ':git' if the cookbook lives in a git repo.  Use ':path' if the cookbook lives on your local disk.  Librarian retrieves the cookbooks from their "source" and puts all of them in Librarian's tmp cache directory which is transparent during normal Librarian use.  Then Librarian puts only one "copy" of each cookbook into the chef-repo/cookbooks directory.

Archive powered by MHonArc 2.6.16.