Search code examples
rubychef-infrachef-solo

Trouble with chef-solo "Missing Cookbooks"


I am trying to run chef-solo, and I have the following configuration

/var/chef

├── cookbooks
│   ├── cc_db
│   │   ├── Berksfile
│   │   ├── Berksfile.lock
│   │   ├── chefignore
│   │   ├── metadata.rb
│   │   ├── recipes
│   │   │   └── default.rb
├── node.json
└── solo.rb

node.json

{
  "run_list": [ "recipe[cc_db]" ]
}

solo.rb

file_cache_path "/var/chef"
  cookbook_path "/var/chef/cookbooks"
  json_attribs "/var/chef/node.json"

metadata.rb

depends 'database', '~> 5.1.2'
depends 'mysql2_chef_gem', '~> 1.0'

I've gotten this to work in a kitchen-test environment, but I'm trying it now on a different server using chef-solo.

Whenever I run: chef-solo -c solo.rb

I get:

resolving cookbooks for run list: ["cc_db"]

================================================================================
Error Resolving Cookbooks for Run List:
================================================================================

Missing Cookbooks:
------------------
No such cookbook: database

Expanded Run List:
------------------
* cc_db

Platform:
---------
x86_64-linux


Running handlers:
[2016-09-20T15:34:05-04:00] ERROR: Running exception handlers
Running handlers complete
[2016-09-20T15:34:05-04:00] ERROR: Exception handlers complete
Chef Client failed. 0 resources updated in 02 seconds
[2016-09-20T15:34:05-04:00] FATAL: Stacktrace dumped to /var/chef/chef-stacktrace.out
[2016-09-20T15:34:05-04:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
[2016-09-20T15:34:05-04:00] ERROR: 412 "Precondition Failed"
[2016-09-20T15:34:05-04:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)

I'm confused because the database cookbook seem to be installed with berks, but chef isn't picking it up.

any help would be greatly appreciated.

thanks. myles.


Solution

  • Chef doesn't directly integrate with Berkshelf, so chef-solo knows nothing about that. Normally you would use something like knife-solo which ties them together, but you could also do it manually. Run berks vendor /path/to/a/folder and then set that folder as the cookbook_path.