[chef] Re: Re: using Berkshelf


Chronological Thread 
  • From: Calvin Worsnup < >
  • To: " " < >
  • Subject: [chef] Re: Re: using Berkshelf
  • Date: Wed, 19 Mar 2014 19:12:20 +0000
  • Accept-language: en-US

Additionally, I learned a cool trick recently. 

You can "override" the source cookbook and file of a template. Example:
include_recipe 'varnish'
begin
  r = resources(:template => node['varnish']['default'])
  r.source "custom-default.erb"
  r.cookbook "mosaic"
rescue Chef::Exceptions::ResourceNotFound
  Chef::Log.warn "could not find VARNISH template to override!"
End

Where mosaic is our custom cookbook for our product and custom-default.erb is our custom default we want the Varnish Community Cookbook to use. It was fantastic for changing a small element of the cookbook without having to fork it entirely :)

Calvin


Sam,

I'd recommend watching Jamie's presentation: http://www.youtube.com/watch?v=hYt0E84kYUI

Thanks,
Seth

On Mar 19, 2014, at 2:52 PM, Sam Darwin < "> > wrote:

Hi,

I have just started reading about Berkshelf. The first thing which comes
to mind, is the fact that cookbooks are not like ruby gems: because it's nice
to customize cookbooks.     Usually the ruby gems can be used as-is.

So, let's say you write a wrapper customized nginx cookbook, and pull in a
community nginx cookbook from Berkshelf.   What causes them to mesh/overlap?
Does the "depends" statement, or the "include_recipe" statement cause all
aspects of the community cookbook to be exposed and available to the customized
cookbook?  i.e.  not just the recipes, but all the templates, files,
definitions, etc are imported to the new cookbook?   which command does that?

Secondly, let's say you want to customize only a small aspect.Modify only a
single template.  modify a single attribute.  modify a small part of a recipe.
 How does these things integrate ?   How does the community cookbook and your
new customized cookbook come together, into a brand new super cookbook?


This email and any attachments may contain confidential and proprietary information of Blackboard that is for the sole use of the intended recipient. If you are not the intended recipient, disclosure, copying, re-distribution or other use of any of this information is strictly prohibited. Please immediately notify the sender and delete this transmission if you received this email in error.



Archive powered by MHonArc 2.6.16.

§