包括另一本食谱中的厨师LWRP [英] Including a Chef LWRP from another cookbook
问题描述
我在app
菜谱(trim_log
)上写了一个小型LWRP,它可以正常工作.但是,现在我正在尝试将特定的LWRP移到commons
食谱中,以便我的其他食谱也可以使用它.问题是我无法弄清楚如何在trim_log
资源/提供程序中加载任何食谱,包括我的app
食谱.
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
我在公共食谱中定义了trim_log
提供程序/资源.现在,我希望在app
食谱中使用此trim_log
提供程序/资源.我如何在那里提供它?
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?
推荐答案
我相信您需要:
- 在
app/metadata.rb
中声明您依赖于commons
食谱. - 在
app/recipes/default.rb
中将资源引用为commons_trim_log
.
- Declare in the
app/metadata.rb
that you depend on thecommons
cookbook. - Refer to the resource as
commons_trim_log
inapp/recipes/default.rb
.
这篇关于包括另一本食谱中的厨师LWRP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!