I'm making my first recipes in chef. I created a cookbook i called common with just one recipe (default.rb):
apt_repository "mariadb-repo" do
uri "http://tedeco.fi.upm.es/mirror/mariadb/repo/10.1/ubuntu"
distribution "trusty"
components ["main"]
arch "amd64"
keyserver "keyserver.ubuntu.com"
key "CBCB082A"
end
I added "depends 'apt'" at the end of my metadata.rb. If i run:
Starting Chef Client, version 12.5.1
resolving cookbooks for run list: ["common"]
================================================================================
Error Resolving Cookbooks for Run List:
================================================================================
Missing Cookbooks:
------------------
No such cookbook: apt
Expanded Run List:
------------------
* common
Running handlers:
[2016-01-28T13:07:17+00:00] ERROR: Running exception handlers
Running handlers complete
[2016-01-28T13:07:17+00:00] ERROR: Exception handlers complete
Chef Client failed. 0 resources updated in 01 seconds
[2016-01-28T13:07:17+00:00] FATAL: Stacktrace dumped to /home/vagrant/.chef/local-mode-cache/cache/chef-stacktrace.out
[2016-01-28T13:07:17+00:00] ERROR: 412 "Precondition Failed"
[2016-01-28T13:07:17+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
Ok, so i added to my Berksfile:
source 'https://supermarket.chef.io'
cookbook 'apt'
metadata
Then tried installing apt cookbook to several locations:
$ berks install # installs to ~/.berkshelf/cookbooks/
$ berks vendor --except=common berks-cookbooks/
First thing i notice is that the second command packages both cookbooks, apt and my common, to the directory i specify (even passing --except=common). Nevermind: If i now try to run:
$ sudo chef-client --local-mode --runlist 'recipe[common]'
From my cookbook's (the one i called common) directory AND from the berks-cookbooks directory. None of both worked, the error above persist. I tried also with the following client.rb at my cookbook's directory:
cookbook_path = "./berks-cookbooks"
chef_repo_path = "#{cookbook_path}"
And some variations of these...
What am i missing? What's the way to get those dependencies correctly satisfied with chef-client in local mode?
What's the way of satisfying that dependencies?
'''EDIT 1''': Running without sudo does not work.