10

I'm trying to run a django-server in a Vagrant box using Chef, but I've been stuck on this for a few hours and can't find anything online. The relevant bit of my vagrantfile looks like this: (sorry for the poor indentation) Also, the box is running centos7.

config.vm.provision :chef_solo do |chef|
chef.cookbooks_path = "cookbooks"
chef.add_recipe "apache2"
chef.add_recipe "apt"
chef.add_recipe "bluepill"
chef.add_recipe "build-essential"
chef.add_recipe "chef-sugar"
chef.add_recipe "chef_handler"
chef.add_recipe "cms-scanner"
chef.add_recipe "gunicorn"
chef.add_recipe "homebrew"
chef.add_recipe "install_from"
chef.add_recipe "iptables"
chef.add_recipe "logrotate"
chef.add_recipe "metachef"
chef.add_recipe "mysql"
chef.add_recipe "nginx"
chef.add_recipe "ohai"
chef.add_recipe "openssl"
chef.add_recipe "packagecloud"
chef.add_recipe "pacman"
chef.add_recipe "python"
chef.add_recipe "rbac"
chef.add_recipe "redis"
chef.add_recipe "runit"
chef.add_recipe "smf"
chef.add_recipe "windows"
chef.add_recipe "yum"
chef.add_recipe "yum-epel"
end

And I get this error when I run vagrant provision

 C:\Users\garrowa\Desktop\cms-vagrant>vagrant provision
    ==> default: Running provisioner: chef_solo...
    ==> default: Detected Chef (latest) is already installed
    Generating chef JSON and uploading...
    ==> default: Running chef-solo...
    ==> default: [2015-06-30T18:04:53-04:00] INFO: Forking chef instance to converge
    ...
    ==> default: [2015-06-30T18:04:53-04:00] INFO: *** Chef 12.4.0 ***
    ==> default: [2015-06-30T18:04:53-04:00] INFO: Chef-client pid: 4398
    ==> default: [2015-06-30T18:04:55-04:00] INFO: Setting the run_list to ["recipe[
    apache2]", "recipe[apt]", "recipe[bluepill]", "recipe[build-essential]", "recipe
    [chef-sugar]", "recipe[chef_handler]", "recipe[cms-scanner]", "recipe[gunicorn]"
    , "recipe[homebrew]", "recipe[install_from]", "recipe[iptables]", "recipe[logrot
    ate]", "recipe[metachef]", "recipe[mysql]", "recipe[nginx]", "recipe[ohai]", "re
    cipe[openssl]", "recipe[packagecloud]", "recipe[pacman]", "recipe[python]", "rec
    ipe[rbac]", "recipe[redis]", "recipe[runit]", "recipe[smf]", "recipe[windows]",
    "recipe[yum]", "recipe[yum-epel]"] from CLI options
    ==> default: [2015-06-30T18:04:55-04:00] INFO: Run List is [recipe[apache2], rec
    ipe[apt], recipe[bluepill], recipe[build-essential], recipe[chef-sugar], recipe[
    chef_handler], recipe[cms-scanner], recipe[gunicorn], recipe[homebrew], recipe[i
    nstall_from], recipe[iptables], recipe[logrotate], recipe[metachef], recipe[mysq
    l], recipe[nginx], recipe[ohai], recipe[openssl], recipe[packagecloud], recipe[p
    acman], recipe[python], recipe[rbac], recipe[redis], recipe[runit], recipe[smf],
     recipe[windows], recipe[yum], recipe[yum-epel]]
    ==> default: [2015-06-30T18:04:55-04:00] INFO: Run List expands to [apache2, apt
    , bluepill, build-essential, chef-sugar, chef_handler, cms-scanner, gunicorn, ho
    mebrew, install_from, iptables, logrotate, metachef, mysql, nginx, ohai, openssl
    , packagecloud, pacman, python, rbac, redis, runit, smf, windows, yum, yum-epel]

    ==> default: [2015-06-30T18:04:55-04:00] INFO: Starting Chef Run for localhost
    ==> default: [2015-06-30T18:04:55-04:00] INFO: Running start handlers
    ==> default: [2015-06-30T18:04:55-04:00] INFO: Start handlers complete.
    ==> default: [2015-06-30T18:04:55-04:00] ERROR: Running exception handlers
    ==> default: [2015-06-30T18:04:55-04:00] ERROR: Exception handlers complete
    ==> default: [2015-06-30T18:04:55-04:00] ERROR: undefined method `cheffish' for
    nil:NilClass
    ==> default: [2015-06-30T18:04:55-04:00] FATAL: Chef::Exceptions::ChildConvergeE
    rror: Chef run process exited unsuccessfully (exit code 1)
    Chef never successfully completed! Any errors should be visible in the
    output above. Please fix your recipes so that they properly complete.

What really confuses me is that I can't find any references to cheffish anywhere in any of these cookbooks.

I've tried eliminating all chef.add_recipe lines except ohai, and alternatively yum, but I still get the same error. (I am running vagrant reload and vagrant provision between tries. I've also tried sshing into the box, removing the cheffish gem, running vagrant provision, and reinstalling the cheffish gem and running vagrant provision, but to no avail.

Mark Amery
  • 143,130
  • 81
  • 406
  • 459
agarrow
  • 457
  • 2
  • 7
  • 17
  • Cheffish is [part of Chef](https://github.com/chef/chef/commit/bf6340a113dd0c37e2084c70007d201742f11e9d#diff-ce5d78d20ca098b17602b9487c352109), so you're right its not getting pulled in by your cookbooks. I don't know why you would get that error though. – Sneal Jul 01 '15 at 06:39
  • I'm experiencing this for the first time today as well - guessing it was introduced in 12.4.0. – Matt O Jul 01 '15 at 06:55
  • I hate to say me too, but me too. – tom Jul 01 '15 at 11:49
  • 1
    @MattO you were right, I switched to 12.3.0 and now it works :) – agarrow Jul 01 '15 at 15:27
  • 2
    Still a bug in 12.4.1. Also it's worth noting that if you set the log level of your chef provisioner to debug (chef.log_level = :debug), you'll likely see some other error. That cheffish thing is masking the real error. – ZombieDev Jul 10 '15 at 13:42

7 Answers7

7

Finally got it. As pointed out in the comments this problem is introduced in chef v. 12.4.0, I added the line chef.version = "12.3.0" to the provision block and now it's working.

agarrow
  • 457
  • 2
  • 7
  • 17
  • And is it a bug in 12.4.0, or is it a backwards-compatibility break? – StephenKing Jul 07 '15 at 09:03
  • 2
    Setting in the Vagrant file didn't work for me; I was able to set the version in _.kitchen.yml_: `provisioner: name: chef_solo require_chef_omnibus: 12.3.0` – Cory Ringdahl Jul 17 '15 at 18:06
  • In Vagrant [set the chef version with vagrant-omnibus](http://stackoverflow.com/a/18213542/567399). – mmell Jul 21 '15 at 18:00
  • For me, adding `require_chef_omnibus: 12.3.0` to `.kitchen.yml` results in a "missing 'name' attribute in cookbook" error. After adding the "name" attribute to `metadata.rb` in each cookbook, it works. – arimbun Sep 01 '15 at 12:30
1

for me the solution was to make sure every cookbook I was using had a "name" attribute in it with the name of the cookbook. 'redis', 'install_from', and 'metachef' cookbooks were all missing the name field from the metadata.rb

chef-client v12.3.0 helped uncover this, 12.4.1 was not showing me anything useful

rojomisin
  • 71
  • 1
  • 3
1

The error for me was related to two custom cookbooks that someone how had the same name in metadata.rb correcting it fixed it.

QuantumLicht
  • 2,103
  • 3
  • 23
  • 32
0

I had exactly the same error when using a custom cookbook with a include_recipe call at the top of a recipe in that custom cookbook. What fixed it for me is adding a metadata.rb to the custom cookbook. It should contain name and depends sections. Hope this helps

Georgi Tenev
  • 338
  • 4
  • 18
  • Hey thanks for responding, I don't think it had anything to do with my recipe though, even when I didn't include it at all I had the same error. Changing chef versions solved it though. – agarrow Jul 01 '15 at 15:33
0

It happens if you try to use include_attribute 'foo' in metadata.rb instead of attributes file.

0

I've gotten this same error in Test Kitchen as well, though, not caused by the bug. The error message is exceptionally cryptic for the general case of a cookbook constraint not being met (i.e. a cookbook name or version that can't be found). In my case, from .kitchen.yml, I included an environment with specific cookbook version constraints, then specified conflicting version constraints in a Berksfile. That was dumb, so don't do that!

erk
  • 461
  • 2
  • 9
0

Got this due to omitting the name from a cookbook's metadata.rb. Adding the name fixed it.

The message we're seeing is clearly a bug in Chef and hopefully will get fixed soon, but in the meantime perhaps this can help anybody who made the same mistake as me.

Mark Amery
  • 143,130
  • 81
  • 406
  • 459