'chef provision' command and metadata.rb dependencies


#1

Kia Ora from New Zealand!

How are folks managing their provisioning cookbook dependencies? What approaches are others currently using? Would be great to discuss and add some pointers in the documentation.

The chef provision command defaults to looking for a cookbook in the current directory under ./provision.

The chefdk policy related commands default to using Policyfile.rb in the current directory as well.

It feels right that the Policyfile.rb and ./provision cookbook are placed at the top level of a cookbook together to facilitate deployment and testing of that cookbook.

The dependencies of the target cookbook and it’s provision cookbook obviously differ, but it’s unclear to me how to manage the _./provision _ dependencies. Ideally I could just specify a chef export or berks vendor dump referenced from my _./provision
_ cookbook somehow.

Either way, I would like to place dependencies in ./provision/metadata.rb and use chef install ; chef update ; chef provision --sync flow to run the provision cookbook.

However chef provision fails to pick up the dependencies:

[app_server_cookbook]$ grep depends ./provision/metadata.rb                                                                                                                                                                     
depends 'dnsimple'

[app_server_cookbook]$ chef provision ticket_12345 --sync
Uploading policy to policy group ticket_12345
Using    app_server          0.1.0   (0fe40946)
...clipping...
Using    chef-sugar          3.3.0   (edbd3c51)
Using    postgresql          4.0.6   (e8eef761)
Installing Cookbook Gems:
Compiling Cookbooks...
Error: Could not find cookbook(s) to satisfy run list ["recipe[provision::default]"] in /home/devops/workspace/chris/chef-repo/site-cookbooks/app_server_cookbook
Reason: (Chef::Exceptions::CookbookNotFound) Cookbook dnsimple not found. If you're loading dnsimple from another cookbook, make sure you configure the dependency in your metadata

Cheers,
@hippiehacker


#2

I’m opening an issue at https://github.com/chef/chef-web-docs-2016/issues/833 for this. Feels like a bug in the documentation for the ‘chef provision’ workflow.