问题
I am trying to provision a Vagrant machine using Chef-solo, Berkshelf, and the vagrant-berkshelf plugin. However, the provisioning fails with this error:
Berkshelf::CookbookNotFound: Cookbook <cookbook name> not found in any of the default locations
berks install
successfully installs everything to ~/.berkshelf/cookbooks/
, but the cookbooks are never copied over to ~./berkshelf/default/vagrant/berkshelf-20131017-8441-pqghfq-default
which is where Berkshelf reports it is updating, right before the trace:
[Berkshelf] Updating Vagrant's berkshelf: '/Users/<me>/.berkshelf/default/vagrant/berkshelf-20131017-8441-pqghfq-default'
So, I guess my questions are:
- Who is responsibile for copying the cookbooks to the specific Vagrant folder (Berkshelf, the vagrant-berkshelf plugin, or Vagrant)? I've browsed through each repo's source this evening, but haven't been able to nail down where this is supposed to happen.
- Is there any more information I can provide to help answer question #1? :)
Environment Detail:
Mac OSX 10.8 ruby 1.9.3
vagrant -v: 1.3.5
berks -v : Berkshelf (2.0.10)
$: vagrant plugin list
buff-config (0.2.0)
mini_portile (0.5.1)
nugrant (1.1.0)
vagrant-berkshelf (1.3.4)
vagrant-cachier (0.1.0)
vagrant-omnibus (1.1.1)
vagrant-rackspace (0.1.3)
回答1:
Who is responsibile for copying the cookbooks to the specific Vagrant folder (Berkshelf, the vagrant-berkshelf plugin, or Vagrant)?
A little from column A and a little from column B, both of which get some help from column C.
The Vagrant chef-solo provisioner has the ability to copy cookbooks (+ roles/data bags/etc) from the host machine to the guest. It does this by creating a directory on the host and then mounting that directory within the VM.
The vagrant-berkshelf plugin first creates a directory on the host and then uses vanilla Berkshelf functionality to export all of the relevant cookbooks to this directory.
Lastly the vagrant-berkshelf plugin tells the Chef-Solo provisioner to use the directory it has created as the source for the cookbooks it should copy across to the guest.
回答2:
I had a similar issue trying to provision a vagrant box. I solved my problem in the following way.
In Berksfile, add the following
'cookbook-name', path: "<path to cookbook>"
is usually "cookbooks/cookbook-name"
Berksfile was then able to find the cookbook and copy it to berksfile's location which is where the chef-solo looks to find the cookbooks. I hope it helps.
来源:https://stackoverflow.com/questions/19441847/berkshelf-cookbooks-are-not-being-copied-to-the-vagrant-directory