我有一个项目目录
/
VagrantFile
/cookbooks
/nginx
..
在VagrantFile
:
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.box = "mediapop"
config.vm.box_url = "http://cloud-images.ubuntu.com/precise/current/precise-server-cloudimg-vagrant-amd64-disk1.box"
config.vm.provision :chef_solo do |chef|
chef.add_recipe "nginx"
end
end
我运行vagrant up
并得到:
$ vagrant halt && vagrant up
[default] Attempting graceful shutdown of VM...
Bringing machine 'default' up with 'virtualbox' provider...
[default] Setting the name of the VM...
[default] Clearing any previously set forwarded ports...
[default] Fixed port collision for 22 => 2222. Now on port 2201.
[default] Creating shared folders metadata...
[default] Clearing any previously set network interfaces...
[default] Preparing network interfaces based on configuration...
[default] Forwarding ports...
[default] -- 22 => 2201 (adapter 1)
[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] Mounting shared folders...
[default] -- /vagrant
[default] -- /tmp/vagrant-chef-1/chef-solo-1/cookbooks
[default] Running provisioner: VagrantPlugins::Chef::Provisioner::ChefSolo...
Generating chef JSON and uploading...
Running chef-solo...
stdin: is not a tty
[2013-03-22T09:16:26+00:00] INFO: *** Chef 10.12.0 ***
[2013-03-22T09:16:27+00:00] INFO: Setting the run_list to ["recipe[nginx]"] from JSON
[2013-03-22T09:16:27+00:00] INFO: Run List is [recipe[nginx]]
[2013-03-22T09:16:27+00:00] INFO: Run List expands to [nginx]
[2013-03-22T09:16:27+00:00] INFO: Starting Chef Run for vagrant-ubuntu-quantal-64
[2013-03-22T09:16:27+00:00] INFO: Running start handlers
[2013-03-22T09:16:27+00:00] INFO: Start handlers complete.
[2013-03-22T09:16:27+00:00] ERROR: Running exception handlers
[2013-03-22T09:16:27+00:00] ERROR: Exception handlers complete
[2013-03-22T09:16:27+00:00] FATAL: Stacktrace dumped to /tmp/vagrant-chef-1/chef-stacktrace.out
[2013-03-22T09:16:27+00:00] FATAL: NoMethodError: undefined method `[]' for nil:NilClass
Chef never successfully completed! Any errors should be visible in the
output above. Please fix your recipes so that they properly complete.
nginx 目录来自克隆https://github.com/opscode-cookbooks/nginx。
我究竟做错了什么?