2013-02-28 113 views
0

我想将cookbook路径设置到某个地方,以便我不需要每次(在vagrant init之后)修改Vagrantfile 。vagrantfile食谱路径

我发现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加载顺序的第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. 

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

+0

我建议使用[图书管理员 - 厨师](https://github.com/applicationsonline/librarian-chef)来管理你的食谱。 – allonhadaya 2013-04-22 07:49:42

+0

谢谢,我稍后再试 – HaveF 2013-04-22 11:36:45

回答

1

尝试以下步骤: - 创建于vagrantfile目录 文件夹食谱 - 结帐的食谱到这个目录 - 以下内容添加到您的vagrantfile

chef.cookbooks_path = ["cookbooks"] 

希望能有帮助

+0

也许我没有明确解释我的问题。我将cookbooks_path添加到第三个加载位置(http://docs-v1.vagrantup.com/v1/docs/vagrantfile.html)(Vagrantfile加载顺序部分)。并且不想在第4个加载位置再次添加... – HaveF 2013-04-22 11:40:53