厨师 - 使用同一本食谱中的食谱
chef - using recipes from same cookbook
我有食谱 base
和食谱 myapp
基地有 2 个配方 - my_java
和 java_with_custom_stuff
在 java_with_custom_stuff
我想使用 my_java
的食谱(同一食谱)。像
include_recipe 'my_java'
bash 'custom stuff' do
...
end
在myapp
我愿意
include_recipe "base::java_with_custom_stuff"
但它抱怨找不到 my_java
有没有办法使用同一食谱中的食谱?
include_recipe
每次都使用第一部分作为食谱名称。所以你必须指定食谱 - 名称+食谱名称:
include_recipe '::my_java' # works still after you rename your cookbook
include_recipe 'base::my_java' # works only as long as your cookbook name is base
我有食谱 base
和食谱 myapp
基地有 2 个配方 - my_java
和 java_with_custom_stuff
在 java_with_custom_stuff
我想使用 my_java
的食谱(同一食谱)。像
include_recipe 'my_java'
bash 'custom stuff' do
...
end
在myapp
我愿意
include_recipe "base::java_with_custom_stuff"
但它抱怨找不到 my_java
有没有办法使用同一食谱中的食谱?
include_recipe
每次都使用第一部分作为食谱名称。所以你必须指定食谱 - 名称+食谱名称:
include_recipe '::my_java' # works still after you rename your cookbook
include_recipe 'base::my_java' # works only as long as your cookbook name is base