Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Including a Chef LWRP from another cookbook

I wrote a small LWRP my app cookbook (trim_log), and it works. However, now I am trying to move this particular LWRP in to the commons cookbook so that my other cookbooks can also use it. The problem is that I cannot figure out how to load in the trim_log resource/provider in to any of the cookbooks, including my app cookbook.

├── app
│   ├── recipes
│       └── default.rb
├── commons
   ├── providers
   │   └── trim_log.rb
   └── resources
       └── trim_log.rb

I have defined the trim_log provider/resource in the commons cookbook. Now I wish to use this trim_log provider/resource in the app cookbook. How can I make it available there?

like image 585
Michael van Rooijen Avatar asked Jun 26 '13 21:06

Michael van Rooijen


1 Answers

I believe you need to:

  • Declare in the app/metadata.rb that you depend on the commons cookbook.
  • Refer to the resource as commons_trim_log in app/recipes/default.rb.
like image 90
Emil Sit Avatar answered Nov 16 '22 02:11

Emil Sit