2

主要问题 为什么厨师看不到食谱路径中的食谱文件?我该如何解决?

已安装

  • rbenv
  • 厨师长
  • vagrant-berkshelf 插件

我已经做过的事情

把它放在我的 .zshrc

eval "$(rbenv init -)"
export PATH="/opt/chefdk/bin:$PATH" 

还安装了一个berks,它可以工作!

$ berks install
Resolving cookbook dependencies...
Fetching 'app' from source at .
Using app (0.1.0) from source at .
Using apt (2.6.0)
Using java (1.29.0)
Using rbenv (0.7.2) from git://github.com/fnichol/chef-rbenv.git (at v0.7.2)
Using ruby_build (0.8.0) from git://github.com/fnichol/chef-ruby_build.git (at v0.8.0)

流浪规定(错误):

$ vagrant provision
==> default: Loading Berkshelf datafile...
==> default: Sharing cookbooks with VM
==> default: Couldn't find Cheffile at ./Cheffile.
==> default: Updating Vagrant's Berkshelf...
==> default: Resolving cookbook dependencies...
==> default: Fetching 'app' from source at .
==> default: Using app (0.1.0) from source at .
==> default: Using java (1.29.0)
==> default: Using ruby_build (0.8.0) from git://github.com/fnichol/chef-ruby_build.git (at v0.8.0)
==> default: Using apt (2.6.0)
==> default: Using rbenv (0.7.2) from git://github.com/fnichol/chef-rbenv.git (at v0.7.2)
==> default: Vendoring app (0.1.0) to /Users/****/.berkshelf/vagrant-berkshelf/shelves/berkshelf20141128-98987-1p3n8pb-default/app
==> default: Vendoring apt (2.6.0) to /Users/****/.berkshelf/vagrant-berkshelf/shelves/berkshelf20141128-98987-1p3n8pb-default/apt
==> default: Vendoring java (1.29.0) to /Users/****/.berkshelf/vagrant-berkshelf/shelves/berkshelf20141128-98987-1p3n8pb-default/java
==> default: Vendoring rbenv (0.7.2) to /Users/****/.berkshelf/vagrant-berkshelf/shelves/berkshelf20141128-98987-1p3n8pb-default/rbenv
==> default: Vendoring ruby_build (0.8.0) to /Users/****/.berkshelf/vagrant-berkshelf/shelves/berkshelf20141128-98987-1p3n8pb-default/ruby_build
==> default: Chef 12.0.1 Omnibus package is already installed.
==> default: Running provisioner: chef_solo...
Generating chef JSON and uploading...
==> default: Running chef-solo...
==> default: stdin: is not a tty
==> default: [2014-12-12T13:42:11+00:00] INFO: Forking chef instance to converge...
==> default: [2014-12-12T13:42:11+00:00] INFO: *** Chef 12.0.1 ***
==> default: [2014-12-12T13:42:11+00:00] INFO: Chef-client pid: 10274
==> default: [2014-12-12T13:42:17+00:00] INFO: Setting the run_list to ["recipe[app]", "recipe[ruby_build]", "recipe[rbenv::user]", "recipe[rbenv::user_install]", "recipe[rbenv::vagrant]"] from CLI options
==> default: [2014-12-12T13:42:17+00:00] INFO: Run List is [recipe[app], recipe[ruby_build], recipe[rbenv::user], recipe[rbenv::user_install], recipe[rbenv::vagrant]]
==> default: [2014-12-12T13:42:17+00:00] INFO: Run List expands to [app, ruby_build, rbenv::user, rbenv::user_install, rbenv::vagrant]
==> default: [2014-12-12T13:42:17+00:00] INFO: Starting Chef Run for app-berkshelf
==> default: [2014-12-12T13:42:17+00:00] INFO: Running start handlers
==> default: [2014-12-12T13:42:17+00:00] INFO: Start handlers complete.
==> default: [2014-12-12T13:42:17+00:00] WARN: found a directory cookbooks in the cookbook path, but it contains no cookbook files. skipping.
==> default: [2014-12-12T13:42:17+00:00] WARN: found a directory tmp in the cookbook path, but it contains no cookbook files. skipping.
==> default: [2014-12-12T13:42:17+00:00] WARN: found a directory vagrant-berkshelf in the cookbook path, but it contains no cookbook files. skipping.
==> default: [2014-12-12T13:42:17+00:00] ERROR: Running exception handlers
==> default: [2014-12-12T13:42:17+00:00] ERROR: Exception handlers complete
==> default: [2014-12-12T13:42:17+00:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
==> default: [2014-12-12T13:42:17+00:00] ERROR: Cookbook app not found. If you're loading app from another cookbook, make sure you configure the dependency in your metadata
==> default: [2014-12-12T13:42:17+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
Chef never successfully completed! Any errors should be visible in the
output above. Please fix your recipes so that they properly complete.

如果您想了解更多信息,请询问。

更新添加流浪文件:

# -*- mode: ruby -*-
# vi: set ft=ruby :

# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"

Vagrant.require_version ">= 1.5.0"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|

  config.vm.hostname = "app-berkshelf"
  config.vm.box = "chef/ubuntu-14.04"

  # Assign this VM to a host-only network IP, allowing you to access it
  # via the IP. Host-only networks can talk to the host machine as well as
  # any other machines on the same network, but cannot be accessed (through this
  # network interface) by any external networks.
  config.vm.network :private_network, type: "dhcp"

  # The path to the Berksfile to use with Vagrant Berkshelf
  config.berkshelf.berksfile_path = "./Berksfile"

  # Enabling the Berkshelf plugin. To enable this globally, add this configuration
  # option to your ~/.vagrant.d/Vagrantfile file
  config.berkshelf.enabled = true

  # get latest chef
  config.omnibus.chef_version = :latest

  config.vm.provision :chef_solo do |chef|
    chef.custom_config_path = "Vagrantfile.chef"

    chef.json = {
      'rbenv' => {
        'user_installs' => [
          { 'user'    => 'vagrant',
            'rubies'  => ['1.9.3-p551'],
            'global'  => '1.9.3-p551',
            'gems'    => {
              '1.9.3' => [
                { 'name' => 'bundler' }
              ]
            }
          }
        ]
      }
    }

    chef.run_list = [
        'recipe[app]',
        'recipe[ruby_build]',
        'recipe[rbenv::user]',
        'recipe[rbenv::user_install]',
        'recipe[rbenv::vagrant]'
    ]
  end
end

添加了更新 metadata.rb

name             'app'
maintainer       'YOUR_NAME'
maintainer_email 'YOUR_EMAIL'
license          'All rights reserved'
description      'Installs/Configures app'
long_description 'Installs/Configures app'
version          '0.1.0'
4

3 回答 3

1

似乎 vagrant-berkshelf 插件已经过时了。

见:https ://sethvargo.com/the-future-of-vagrant-berkshelf/

于 2015-01-10T10:28:57.173 回答
0

我没有cookbooks_path在您的 Vagrantfile 中看到该集合,将其添加:chef_solo part如下

  config.vm.provision :chef_solo do |chef|
    chef.custom_config_path = "Vagrantfile.chef"
    chef.cookbooks_path = "my_cookbooks"

你有食谱路径设置Vagrantfile.chef吗?你确定吗?

于 2014-12-15T21:16:04.353 回答
0

检查您的应用说明书是否包含metadata.rb具有正确名称值的 a,并且不包含metadata.json.

于 2014-12-12T19:24:12.807 回答