Vagrant 与主厨索洛一起提供流浪者包厢

Vagrant 与主厨索洛一起提供流浪者包厢,vagrant,chef-infra,chef-solo,vagrantfile,Vagrant,Chef Infra,Chef Solo,Vagrantfile,我有一个问题,厨师索洛供应失败的错误 厨师长::例外::CookbookNotFound:未找到Cookbook apt 关于这里可能出现的问题,以及我应该如何解决这个问题,有什么想法吗 主机:Windows7 64位,来宾:Ubuntu 12.04 Virtualbox 4.3.20 ChefDK 0.4.0 流浪汉1.7.2 流浪插件: 流浪汉4.0.2 流浪综合体1.4.1 流浪共享1.1.3,系统 流浪输出: PS C:\VagrantBoxes\mybox> vagran

我有一个问题,厨师索洛供应失败的错误 厨师长::例外::CookbookNotFound:未找到Cookbook apt

关于这里可能出现的问题,以及我应该如何解决这个问题,有什么想法吗

主机:Windows7 64位,来宾:Ubuntu 12.04 Virtualbox 4.3.20 ChefDK 0.4.0 流浪汉1.7.2 流浪插件: 流浪汉4.0.2 流浪综合体1.4.1 流浪共享1.1.3,系统 流浪输出:

    PS C:\VagrantBoxes\mybox> vagrant reload --provision
    default: The Berkshelf shelf is at "C:/Users/dmit77/.berkshelf/vagrant-berkshelf/shelves/berkshelf20150208-6588-1a3oox5-default"
==> default: Sharing cookbooks with VM
==> default: Attempting graceful shutdown of VM...
==> default: Clearing any previously set forwarded ports...
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
==> default: Forwarding ports...
    default: 22 => 2222 (adapter 1)
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address: 127.0.0.1:2222
    default: SSH username: vagrant
    default: SSH auth method: private key
    default: Warning: Connection timeout. Retrying...
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
    default: The guest additions on this VM do not match the installed version of
    default: VirtualBox! In most cases this is fine, but in rare cases it can
    default: prevent things such as shared folders from working properly. If you see
    default: shared folder errors, please make sure the guest additions within the
    default: virtual machine match the version of VirtualBox you have installed on
    default: your host and reload your VM.
    default:
    default: Guest Additions Version: 4.2.12
    default: VirtualBox Version: 4.3
==> default: Mounting shared folders...
    default: /vagrant => C:/VagrantBoxes/mybox
    default: /tmp/vagrant-chef/7159cf65a6eea91634c03008165d96a8/cookbooks => C:/Users/dkrantsber/.berkshelf/vagrant-berkshelf/shelves/berkshelf20150208-6588-1a3oox5-default
==> default: Running provisioner: chef_solo...
==> default: Detected Chef (latest) is already installed
Generating chef JSON and uploading...
==> default: Running chef-solo...
==> default: stdin: is not a tty
==> default: [2015-02-08T05:09:07+00:00] INFO: *** Chef 11.4.0 ***
==> default: [2015-02-08T05:09:08+00:00] INFO: Setting the run_list to ["recipe[apt]", "recipe[apache2]"] from JSON
==> default: [2015-02-08T05:09:08+00:00] INFO: Run List is [recipe[apt], recipe[apache2]]
==> default: [2015-02-08T05:09:08+00:00] INFO: Run List expands to [apt, apache2]
==> default: [2015-02-08T05:09:08+00:00] INFO: Starting Chef Run for vagrant.vm
==> default: [2015-02-08T05:09:08+00:00] INFO: Running start handlers
==> default: [2015-02-08T05:09:08+00:00] INFO: Start handlers complete.
==> default: [2015-02-08T05:09:08+00:00] ERROR: Running exception handlers
==> default: [2015-02-08T05:09:08+00:00] ERROR: Exception handlers complete
==> default: [2015-02-08T05:09:08+00:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
==> default: [2015-02-08T05:09:08+00:00] FATAL: Chef::Exceptions::CookbookNotFound: Cookbook apt not found. If you're loading apache2 from another cookbook, make sure you confi
Chef never successfully completed! Any errors should be visible in the
output above. Please fix your recipes so that they properly complete.
流浪者档案:

  Vagrant.configure("2") do |config|

  config.vm.box = "opscode-ubuntu-12.04_chef-11.4.0"
  config.vm.box_url = "https://opscode-vm-bento.s3.amazonaws.com/vagrant/opscode_ubuntu-12.04_chef-11.4.0.box"
  config.ssh.forward_agent = true


  config.vm.provision :chef_solo do |chef|
    chef.cookbooks_path = ["cookbooks"]
    chef.add_recipe :'apt'
    chef.add_recipe 'apache2'
    chef.json = {
      :apache => {
        :default_site_enabled => "true",
        :dir                  => "/etc/apache2",
        :log_dir              => "/var/log/apache2",
        :error_log            => "error.log"
      }
    }
  end
end
文件夹结构:

[my_box]
[cookbooks]
    [apt]
    [apache2]
Vagrantfile

我终于找到了解决办法。事实证明,流浪汉就是问题所在。卸载它可以解决此问题。

您可以尝试用ssh连接您的box vagrant ssh,并检查/tmp/vagrant chef/7159cf65a6eea91634c03008165d96a8/cookbooks文件夹中是否有烹饪书。另外,请检查cookbooks是否有metadata.rb文件,该文件看起来是否正确。我的vagrant box上的/tmp/vagrant chef/a216041e14f8db851996624148ca222a/cookbooks文件夹为空。有什么可能阻止烹饪书被复制到它里面?另外,在我的主机上,没有cookbooks/apt/metadata.rb文件。而是metadata.json。我用图书管理员的厨师长翻出了这本食谱。这可能是原因吗?