vagrantfile食谱路径

时间:2013-02-28 03:38:44

标签: vagrant

我想将食谱路径设置到某个地方,这样我就不需要了 每次修改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
...

但是当我创建一个新的vm并修改Vagrantfile时(此文件是Vagrantfile加载顺序的第4个):

...
  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.

但我确信具体的食谱是在我的食谱路径下。

1 个答案:

答案 0 :(得分:1)

请尝试以下步骤: - 在vagrantfile的目录中创建文件夹cookbook - 检查这个目录的食谱 - 将以下内容添加到您的vagrantfile

 chef.cookbooks_path = ["cookbooks"]

希望有所帮助