厨师用CookbookNotFound作为我不太需要的烹饪书失败了

时间:2014-05-12 14:24:43

标签: chef chef-solo

我尝试使用virtualbox,vagrant和chef-solo设置VM - 我想这是很常见的事情。这是我的Vagrantfile:

Vagrant::Config.run do |config|
  config.vm.box = "ubuntu-13.04"
  config.vm.box_url = "http://goo.gl/Y4aRr"

  config.vm.network :forwarded_port, guest: 80, host: 8888

  # Necessary for homesick_agent::data_bag
  config.ssh.forward_agent = true

  config.vm.provision :chef_solo do |chef|

     # contains "users" and "ssh_known_hosts" databags
    chef.data_bags_path = "databags"

    chef.cookbooks_path = ["cookbooks", "site-cookbooks"]

    # stuff that should be in base box

    chef.add_recipe "vim"
    chef.add_recipe "git"
    chef.add_recipe "php"
    chef.add_recipe "postgresql::server"
    chef.add_recipe "chef-phppgadmin"
    chef.add_recipe "apache2"
    chef.add_recipe "apache2::mod_fastcgi"
    chef.add_recipe "apache2::mod_php5"
    chef.add_recipe "apache2::mod_ssl"
    chef.add_recipe "python"
    chef.add_recipe "ipynb"
    chef.add_recipe "supervisor"

    # chef.log_level = :debug

  end
end

如您所见,我的目标框是Ubuntu。运行vagrant up之后我得到了:

 ==> default: [2014-05-12T14:04:38+00:00] FATAL: 
Chef::Exceptions::CookbookNotFound: Cookbook mysql not found. 
If you're loading mysql from another cookbook, make sure you configure the dependency in  your metadata

我不需要或想要mysql在我的盒子里!我不想要isswindows以及厨师抱怨的所有其他不同套餐。起初我一个接一个地下载它们但它看起来很傻,所以我想,我做错了什么。任何提示?

1 个答案:

答案 0 :(得分:1)

  • 使用Berkshelf之类的依赖项解析程序自动下载食谱依赖项
  • 如果在metadata.rb中定义了相关的烹饪书,则需要它们。虽然它们可能无法在您的平台上执行,但Chef并没有条件依赖的概念。
  • 你的记法错了。 Chef使用::来分隔cookbook::recipe,而不是单个:(当它在搜索名为postgresql:server的食谱及其默认配方时,这会给您带来麻烦。