我想将食谱路径设置到某个地方,这样我就不需要每次都修改 Vagrantfile(在 vagrant init 之后)。
我发现Vagrantfile加载了几个地方,所以我决定在 ~/.vagrant.d/Vagrantfile 中设置我的食谱路径信息,(这个文件是 Vagrantfile 加载顺序的第 3 个),例如:
...
config.vm.provision :chef_solo do |chef|
chef.cookbooks_path = ["D:/lib/chef/cookbooks"]
chef.add_recipe "dev::default"
end
...
但是当我创建一个新的虚拟机并修改 Vagrantfile 时(这个文件是 Vagrantfile 加载顺序的第四个):
...
config.vm.provision :chef_solo do |chef|
chef.add_recipe "torch"
end
...
错误:
[2013-02-28T03:23:36+00:00] ERROR: Running exception handlers
[2013-02-28T03:23:36+00:00] ERROR: Exception handlers complete
[2013-02-28T03:23:36+00:00] FATAL: Stacktrace dumped to /tmp/vagrant-chef-1/chef-stacktrace.out
[2013-02-28T03:23:36+00:00] FATAL: Chef::Exceptions::CookbookNotFound: Cookbook torch not found. If
you're loading torch 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.
但我确信特定的食谱在我的食谱路径下。