Including a Chef LWRP from another cookbook

别来无恙 提交于 2019-12-04 08:51:24

问题


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?


回答1:


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.


来源:https://stackoverflow.com/questions/17330374/including-a-chef-lwrp-from-another-cookbook

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!