I have a few ubuntu machines that I need to have configured the same, so I use chef-solo against chef cookbooks in a shared directory mounted read-only to accomplish this. I've been using chef-solo for over a year, starting with chef version 10. Today, after rebuilding the VMs using packer (I use VMs to test my cookbooks before I use them on the "real" machines, and rebuild them periodically so the are "fresh") my cookbooks began failing with the error:
ERROR: Cookbook loaded at path(s) [/chef/cookbooks/ack-grep] has invalid metadata: The `name' attribute is required in cookbook metadata
I've used these cookbooks many times on several machines, tested them repeatedly in VMs, but I noticed that the newly rebuilt VM had installed chef 12.0.0. An older VM running chef 11 still works great. This holds true for every one of my cookbooks.
I began investigating and researching this issue using google, and everything I found on the subject said to put the "name" entry in the metadata.rb file. But my metadata.rb files already contain a "name" entry. For example, here's my metadata file (edited to not blast my personal info all in a google-able forum):
---- Begin metadata.rb ---------
name 'ack-grep'
maintainer 'me'
maintainer_email 'me@example.com'
license 'All Rights Reserved'
description 'Installs/Configures ack-grep'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version '0.1.0'
------ End metadata.rb -------
The single recipe that is in this cookbook is very simple:
------ Begin default.rb -------
# # Cookbook Name:: ack-grep # Recipe:: default package 'ack-grep' do action :install end
------ End default.rb -------
One Article that I read while researching said creating a metadata.json file would help, so I ran the command:
knife cookbook metadata ack-grep
This command created a metadata.json file, which contained a similar "name" field with the same info as the metadata.rb file plus a lot of other info, all in json format. But running the same chef-solo command again resulted in exactly the same error message.
I'm guessing that since it's complaining about a missing field in the metadata, that exists in both the metadata.rb and the metadata.json files, that I'm missing something else and the error message is wrong. Anybody have better information than this, or know what's going on? Maybe even how to get around/fix it?