Search code examples
rubychef-infracookbookberkshelf

Using a chef cookbook in my own cookbook error


So I am new to chef and want to use chef-patch in my own recipes. I added cookbook 'patch', '~> 2.2.1' to my Berksfile and did sudo berks install and it installs it. But when I run my recipe it says ERROR: undefined method 'replace' for #<Chef::Recipe:0x00000003cab450>

Is there something I need to add to my fix.rb code.

replace "/etc/login.defs" do
       replace "PASS_MAX_DAYS 60"
       with "PASS_MAX_DAYS 59"
end

Solution

  • There is no direct link between Berkshelf and either of those. You need to use berks upload to send things to the Chef server for use with chef-client, and for chef-solo the workflow is up to you (though will probably involve berks vendor to write the cookbooks out at some point). You also need depends 'patch' in your metadata.rb.