Chef无法运行,因为无法访问cookbooks文件夹

kee*_*imi 6 ubuntu virtualbox chef-infra vagrant

我正试图从这个框中使用Vagrant启动实例,然后开始我的厨师食谱.Vagrant文件:

Vagrant::Config.run do |config|
  config.vm.box = "sausy64"
  config.vm.box_url = "http://cloud-images.ubuntu.com/vagrant/saucy/20131113/saucy-server-cloudimg-amd64-vagrant-disk1.box"

  config.vm.provision :chef_solo do |chef|
    chef.cookbooks_path = "."
    chef.add_recipe "test"
  end
end
Run Code Online (Sandbox Code Playgroud)

跑完后vagrant up我得到:

[default] Importing base box 'sausy64'...
[default] Matching MAC address for NAT networking...
[default] Clearing any previously set forwarded ports...
[default] Forwarding ports...
[default] -- 22 => 2222 (adapter 1)
[default] Creating shared folders metadata...
[default] Clearing any previously set network interfaces...
[default] Booting VM...
[default] Waiting for VM to boot. This can take a few minutes.
[default] VM booted and ready for use!
[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...
[2013-11-16T18:15:15+00:00] INFO: *** Chef 10.12.0 ***
[2013-11-16T18:15:16+00:00] INFO: Setting the run_list to ["recipe[test]"] from JSON
[2013-11-16T18:15:16+00:00] INFO: Run List is [recipe[test]]
[2013-11-16T18:15:16+00:00] INFO: Run List expands to [test]
[2013-11-16T18:15:16+00:00] INFO: Starting Chef Run for vagrant-ubuntu-saucy-64
[2013-11-16T18:15:16+00:00] INFO: Running start handlers
[2013-11-16T18:15:16+00:00] INFO: Start handlers complete.
bash: line 2:  1494 Killed                  chef-solo -c /tmp/vagrant-chef-1/solo.rb -j /tmp/vagrant-chef-1/dna.json
Chef never successfully completed! Any errors should be visible in the
output above. Please fix your recipes so that they properly complete.
Run Code Online (Sandbox Code Playgroud)

我做vagrant ssh了检查发生了什么,似乎cookbooks无法访问共享文件夹.

vagrant@vagrant-ubuntu-saucy-64:~$ cd /tmp/vagrant-chef-1/chef-solo-1/cookbooks/
vagrant@vagrant-ubuntu-saucy-64:/tmp/vagrant-chef-1/chef-solo-1/cookbooks$ ls
... CPU goes to 100% and anything shows ...
Run Code Online (Sandbox Code Playgroud)

我该怎么做才能让它发挥作用?

yea*_*yer 9

有同样的问题.

经过一些调查后,我意识到问题出在VirtualBox guest虚拟机添加中,预装了这些Ubuntu 13.10 Vagrant盒子.捆绑版本(4.2.16)在使用内核3.11上的共享文件夹时包含一个错误,根据VirtualBox Changelog,此错误在4.2.20中得到修复.

所以,我刚刚将VirtualBox guest添加内容更新为实际版本,我的共享文件夹再次与cookbook一起工作.这可以通过花哨的vagrant插件来完成

vagrant plugin install vagrant-vbguest
Run Code Online (Sandbox Code Playgroud)

在VM启动期间自动升级guest虚拟机添加.