Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

chef - using recipes from same cookbook

I have cookbook base and cookbook myapp

base has 2 recipes - my_java and java_with_custom_stuff

in java_with_custom_stuff I want to use the recipe for my_java (same cookbook). something like

include_recipe 'my_java'

bash 'custom stuff' do
...
end

in myapp I do include_recipe "base::java_with_custom_stuff"

yet it complains that it cannot find my_java

Is there a way to use a recipe from the same cookbook?

like image 784
Nick Ginanto Avatar asked Aug 10 '16 10:08

Nick Ginanto


1 Answers

include_recipe uses the first part every time as the cookbook name. So you have to specify the cookbook - name + recipe name:

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
like image 88
slowjack2k Avatar answered Oct 16 '22 19:10

slowjack2k