Find wrapper CB files/default/foo instead of wrapped CB files/default/foo?

We’re wrapping the clamav cookbook. It includes the following in a recipe:

cookbook_file node['clamav']['scan']['script']['path'] do
  source ''
  owner node['clamav']['user']
  group node['clamav']['group']
  mode '0555'
  only_if { node['clamav']['scan']['script']['enable'] }

How can I, in my wrapper cookbook, make my-wrapper/files/default/ be what is installed, not the one that comes with the clamav cookbook?

In your wrapper cookbook, use edit_resource to specify the cookbook where to search the file:

edit_resource(:cookbook_file, node['clamav']['scan']['script']['path']) do
  cookbook_name cookbook_name

The right cookbook_name is a Recipe DSL helper containing the name of the current cookbook, so it should modify the resource to tell it to use your wrapper file instead of the original cookbook one.

Documentation for edit_recource:
and for cookbook_name:

1 Like

Thanks! For those who come across this later, know that edit_resource is in Chef Client 12.10+ and the alternative for those of us not running 12.10+ yet is the deprecated chef-rewind helper gem at

That should be cookbook cookbook_name, @Tensibai (and thanks again)