Resolving Chef Cookbook Dependencies

1.3k views Asked by At

I'm following a basic chef tutorial outlined here, which walks you through creating an initial chef-repo with various cookbooks from the supermarket.

I'm at the point where I have a hosted chef account set up and I need to upload all my local cookbooks to my hosted chef server.

So I run this locally -

> knife cookbook upload --all
Uploading apache2      [3.0.1]
Uploading apt          [2.7.0]
Uploading aws          [2.7.0]
Uploading build-essential [2.1.2]
Uploading chef-sugar   [3.1.0]
Uploading chef_handler [1.1.8]
Uploading database     [4.0.6]
Uploading homebrew     [1.12.0]
Uploading iis          [4.1.1]
Uploading iptables     [1.0.0]
Uploading logrotate    [1.9.1]
Uploading mariadb      [0.3.0]
Uploading mysql        [4.1.2]
ERROR: Cookbook mysql depends on cookbooks which are not currently
ERROR: being uploaded and cannot be found on the server.
ERROR: The missing cookbook(s) are: 'build-essential' version '~> 1.4'

Ok, so mysql cookbook is complaining that it needs build-essential, ~> 1.4. No problem, let me just get that specific version...

> knife cookbook site download build-essential 1.4.4

Great, now I have the right build-essential version. Let's try it again..

> knife cookbook upload --all
Uploading apache2      [3.0.1]
Uploading apt          [2.7.0]
Uploading aws          [2.7.0]
Uploading build-essential [1.4.4]
Uploading chef-sugar   [3.1.0]
Uploading chef_handler [1.1.8]
Uploading database     [4.0.6]
Uploading homebrew     [1.12.0]
ERROR: Cookbook homebrew depends on cookbooks which are not currently
ERROR: being uploaded and cannot be found on the server.
ERROR: The missing cookbook(s) are: 'build-essential' version '>= 2.1.2'

Well now it breaks homebrew, which complains it needs build-essenitial, >= 2.12.

How do I get out of this dependency cycle? I can't have two different versions of the same cookbook, can I? I downloaded this straight from the tutorial's site - am I stuck just trying to figure out the right version of all these things?

Thanks!

1

There are 1 answers

0
Roland On

Your mysql cookbook version is old and therefore has old dependencies. Try to upgrade it to the latest release. And also use the new version of build-essenitial.

See https://supermarket.chef.io/cookbooks/mysql