An appetizing recipe will not be installed in my recipe

I am trying to create my first chef recipe with Vagrant and ran into a problem in the first step. The first line of my recipe:

include_recipe "apt" 

But when I try and vagrant provision , I get the following error:

 ==> default: [2014-09-21T07:15:42+00:00] WARN: MissingCookbookDependency: ==> default: Recipe `apt` is not in the run_list, and cookbook 'apt' ==> default: is not a dependency of any cookbook in the run_list. To load this recipe, ==> default: first add a dependency on cookbook 'apt' in the cookbook you're ==> default: including it from in that cookbook metadata. ==> default: [2014-09-21T07:15:42+00:00] ERROR: No resource or method named `apt_installed?' for `Chef::Recipe "default"' ==> default: [2014-09-21T07:15:42+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1) 

This is what my Vagrantfile looks like:

 Vagrant.configure("2") do |config| config.omnibus.chef_version = :latest config.vm.box = "precise32" config.vm.box_url = "http://files.vagrantup.com/precise32.box" config.vm.network :private_network, ip: "192.168.42.42" config.vm.synced_folder "./", "/var/www", group: "www-data", mount_options: ["dmode=777,fmode=664"] config.vm.provision :chef_solo do |chef| chef.cookbooks_path = "cookbooks" chef.data_bags_path = "data_bags" chef.add_recipe "divups" end end 

And the divups default.rb file looks like this:

 include_recipe "apt" puts "So we made it this far..." 

Which is strange, but I can set apt if I include it in my Vagrantfile file above chef.add_recipe "divups" , but if I try to include it in my own recipe, I get the errors that I posted above.

Is there something I am missing or something is wrong?

+5
source share
1 answer

You call the recipe from another cookbook, so you need to add it as a dependency in the cookbook metadata.

Add the following line to the metadata.rb file (in the cookbook divups):

 depends "apt" 
+8
source

Source: https://habr.com/ru/post/1203061/


All Articles