Vagrant “查夫德克和流浪汉”;在cookbook路径中找到cookbooks目录,但它不包含cookbook文件。跳绳;

Vagrant “查夫德克和流浪汉”;在cookbook路径中找到cookbooks目录,但它不包含cookbook文件。跳绳;,vagrant,chef-infra,berkshelf,chefdk,Vagrant,Chef Infra,Berkshelf,Chefdk,主要问题 为什么chef在cookbook路径中看不到cookbook文件? 我怎样才能解决它 已安装 rbenv 切夫德克 流浪汉 我已经做过的事情 把这个放在我的.zshrc里 eval "$(rbenv init -)" export PATH="/opt/chefdk/bin:$PATH" 还安装了一个berks,它可以工作 $ berks install Resolving cookbook dependencies... Fetching 'app' from source

主要问题 为什么chef在cookbook路径中看不到cookbook文件? 我怎样才能解决它

已安装

  • rbenv
  • 切夫德克
  • 流浪汉
我已经做过的事情

把这个放在我的.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)
流浪规定(错误):

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

更新添加漫游文件:

# -*- 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
添加了更新元数据.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'

检查你的应用程序cookbook是否包含具有正确名称值的
metadata.rb
,并且不包含
metadata.json

我没有在你的Vagrant文件中看到
cookbooks\u路径设置,请将其添加到
:chef\u solo part
中,如下所示

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

您是否在Vagrantfile.chef中设置了cookbook路径?你能确认一下吗?

似乎vagrant berkshelf插件已经过时了


请参阅:

您能将
Vagrantfile
的内容粘贴到这里吗?添加了Vagrantfile它不包含metdata.json,并且在berkshelfs页面的原始帖子中添加了metadata.rb,上面写着“Chef Solo provisioner的cookbook_路径属性在使用Vagrant Berkshelf插件时被劫持”。当我安装此插件时输出是“Vagrant Berkshell插件需要来自Chef开发工具包的Berkshell。”我的机器上安装了sdk。另外,当我将我的cookbook路径设置为~/.berkself/cookbooks时,它不起作用
Vagrantfile
中的路径是相对路径。这不是我正在搜索的解决方案。这是可行的,但我需要在每个项目中设置它+我的团队成员有不同的路径。
  config.vm.provision :chef_solo do |chef|
    chef.custom_config_path = "Vagrantfile.chef"
    chef.cookbooks_path = "my_cookbooks"