我正试图与Berkshelf一起管理食谱。以下是步骤
$ berks init # and use a custom Vagrant box image
$ vim Berksfile # and put cookbook 'git'
$ berks install
$ vagrant up
我希望最后一步为VM配置git
食谱,但是我得到了:
$ bin/vagrant up /Users/pmu/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/hashie-2.0.0/lib/hashie/mash.rb:80: warning: redefining `object_id' may cause serious problems [default] Importing base box 'Ubuntu-11.04'... [default] Matching MAC address for NAT networking... [default] Clearing any previously set forwarded ports... [default] Forwarding ports... [default] -- 22 => 2222 (adapter 1) [Berkshelf] installing cookbooks... [Berkshelf] Using git (2.3.0) [Berkshelf] Using dmg (1.1.0) [Berkshelf] Using build-essential (1.3.4) [Berkshelf] Using yum (2.1.0) [Berkshelf] Using windows (1.8.4) [Berkshelf] Using chef_handler (1.1.4) [Berkshelf] Using runit (1.0.6) [default] Creating shared folders metadata... [default] Clearing any previously set network interfaces... [default] Preparing network interfaces based on configuration... [default] Booting VM... [default] Waiting for VM to boot. This can take a few minutes. [default] VM booted and ready for use! [default] Configuring and enabling network interfaces... [default] Setting host name... [default] Mounting shared folders... [default] -- v-root: /vagrant [default] -- v-csc-1: /tmp/vagrant-chef-1/chef-solo-1/cookbooks [default] Running provisioner: Vagrant::Provisioners::ChefSolo... [default] Generating chef JSON and uploading... [default] Running chef-solo... stdin: is not a tty [2013-02-24T12:51:04+00:00] INFO: *** Chef 10.18.2 *** [2013-02-24T12:51:05+00:00] INFO: Setting the run_list to ["recipe[berkshelf-test::default]"] from JSON [2013-02-24T12:51:05+00:00] INFO: Run List is [recipe[berkshelf-test::default]] [2013-02-24T12:51:05+00:00] INFO: Run List expands to [berkshelf-test::default] [2013-02-24T12:51:05+00:00] INFO: Starting Chef Run for ubuntu-11.04 [2013-02-24T12:51:05+00:00] INFO: Running start handlers [2013-02-24T12:51:05+00:00] INFO: Start handlers complete. [2013-02-24T12:51:05+00:00] ERROR: Running exception handlers [2013-02-24T12:51:05+00:00] ERROR: Exception handlers complete [2013-02-24T12:51:05+00:00] FATAL: Stacktrace dumped to /tmp/vagrant-chef-1/chef-stacktrace.out [2013-02-24T12:51:05+00:00] FATAL: Chef::Exceptions::CookbookNotFound: Cookbook berkshelf-test not found. If you're loading berkshelf-test from another cookbook, make sure you configure the dependency in your metadata Chef never successfully completed! Any errors should be visible in the output above. Please fix your recipes so that they properly complete.
Vagrantfile中的厨师独奏部分:
config.vm.provision :chef_solo do |chef| chef.json = { :mysql => { :server_root_password => 'rootpass', :server_debian_password => 'debpass', :server_repl_password => 'replpass' } } chef.run_list = [ "recipe[berkshelf-test::default]" ] end
答案 0 :(得分:9)
在这种情况下,问题在于Vagrantfile中的chef.run_list
- 它指示Chef从“berkshelf-test”食谱加载“默认”食谱。如果您使用git cookbook进行测试,则可能需要"recipe[git::default]"
。
您可能还需要将require 'berkshelf/vagrant'
添加到Vagrant文件的顶部。有关更多解释,请参阅the Berkshelf homepage上的“Vagrant With Berkshelf”部分。
答案 1 :(得分:2)
我收到此错误,根本原因是插件如何处理共享文件夹的问题。这个问题的答案修正了它:Vagrant + Chef: Error in provision "Shared folders that Chef requires are missing on the virtual machine."
rm .vagrant/machines/default/virtualbox/synced_folders
vagrant reload --provision