2013-02-24 29 views
6

Tôi đang cố gắng đi với Berkshelf để quản lý sách dạy nấu ăn. Dưới đây là các bướcLàm thế nào để sử dụng Berkshelf với Chef-solo?

$ berks init # and use a custom Vagrant box image 
$ vim Berksfile # and put cookbook 'git' 
$ berks install 
$ vagrant up 

Tôi mong chờ những bước cuối cùng để cung cấp VM với git sách dạy nấu ăn, tuy nhiên tôi nhận được:

 
$ bin/vagrant up 
/Users/pmu/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/hashie-2.0.0/lib/hashie/mash.rb:80: warning: redefining `object_id' may cause serious problems 
[default] Importing base box 'Ubuntu-11.04'... 
[default] Matching MAC address for NAT networking... 
[default] Clearing any previously set forwarded ports... 
[default] Forwarding ports... 
[default] -- 22 => 2222 (adapter 1) 
[Berkshelf] installing cookbooks... 
[Berkshelf] Using git (2.3.0) 
[Berkshelf] Using dmg (1.1.0) 
[Berkshelf] Using build-essential (1.3.4) 
[Berkshelf] Using yum (2.1.0) 
[Berkshelf] Using windows (1.8.4) 
[Berkshelf] Using chef_handler (1.1.4) 
[Berkshelf] Using runit (1.0.6) 
[default] Creating shared folders metadata... 
[default] Clearing any previously set network interfaces... 
[default] Preparing network interfaces based on configuration... 
[default] Booting VM... 
[default] Waiting for VM to boot. This can take a few minutes. 
[default] VM booted and ready for use! 
[default] Configuring and enabling network interfaces... 
[default] Setting host name... 
[default] Mounting shared folders... 
[default] -- v-root: /vagrant 
[default] -- v-csc-1: /tmp/vagrant-chef-1/chef-solo-1/cookbooks 
[default] Running provisioner: Vagrant::Provisioners::ChefSolo... 
[default] Generating chef JSON and uploading... 
[default] Running chef-solo... 
stdin: is not a tty 
[2013-02-24T12:51:04+00:00] INFO: *** Chef 10.18.2 *** 
[2013-02-24T12:51:05+00:00] INFO: Setting the run_list to ["recipe[berkshelf-test::default]"] from JSON 
[2013-02-24T12:51:05+00:00] INFO: Run List is [recipe[berkshelf-test::default]] 
[2013-02-24T12:51:05+00:00] INFO: Run List expands to [berkshelf-test::default] 
[2013-02-24T12:51:05+00:00] INFO: Starting Chef Run for ubuntu-11.04 
[2013-02-24T12:51:05+00:00] INFO: Running start handlers 
[2013-02-24T12:51:05+00:00] INFO: Start handlers complete. 
[2013-02-24T12:51:05+00:00] ERROR: Running exception handlers 
[2013-02-24T12:51:05+00:00] ERROR: Exception handlers complete 
[2013-02-24T12:51:05+00:00] FATAL: Stacktrace dumped to /tmp/vagrant-chef-1/chef-stacktrace.out 
[2013-02-24T12:51:05+00:00] FATAL: Chef::Exceptions::CookbookNotFound: Cookbook berkshelf-test not found. If you're loading berkshelf-test 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. 

Phần đầu bếp-độc tấu trong Vagrantfile:

 
    config.vm.provision :chef_solo do |chef| 
    chef.json = { 
     :mysql => { 
     :server_root_password => 'rootpass', 
     :server_debian_password => 'debpass', 
     :server_repl_password => 'replpass' 
     } 
    } 

    chef.run_list = [ 
     "recipe[berkshelf-test::default]" 
    ] 
    end 

Trả lời

9

Trong trường hợp này, sự cố xảy ra với số chef.run_list trong Vagrantfile của bạn - nó hướng dẫn cho Chef tải công thức "mặc định" từ sách nấu ăn "berkshelf-test". Nếu bạn đang sử dụng git cookbook để thử nghiệm, bạn có thể muốn "recipe[git::default]" thay thế.

Bạn cũng có thể cần thêm require 'berkshelf/vagrant' vào đầu tệp Vagrantfile của mình. Xem phần "Vagrant With Berkshelf" trên the Berkshelf homepage để được giải thích thêm.

+0

Cảm ơn! Thật vậy, sự nhầm lẫn của tôi là về cách Berkshelf thiết lập run_list, trong khi Cookbook nó đề cập đến, không tồn tại. – poseid

+0

Trong trường hợp của tôi, tôi phải thêm sách nấu ăn tùy chỉnh của mình theo: 'berks cookbook my_custom_cookbook' từ thư mục cookbook mục tiêu. Và sau đó: 'berks install' Có thể nó giúp mọi người. – ebaranov

Các vấn đề liên quan