我如何判断 berkshelf 是否连接到我的厨师服务器

How can I tell if berkshelf is connecting to my chef server

我正在尝试将 berkshelf 与 chef 一起使用来配置 Vagrant 机器。这是 运行ning on Windows 7. 我安装了 Berkshelf 作为 Chef-DK 的一部分。它报告版本 3.2.3。我的 vagrant provisioning 失败了,因为它找不到一些食谱。这是我的 Berksfile

的相关部分
source "https://api.opscode.com/organizations/createthegood"
#source "https://api.berkshelf.com"

metadata

cookbook "drupal_site"
cookbook "al_base" 

当我 运行 安装 berks 时,它无法索引源:

D:\Rob\VMs\ctg_cookbook>berks install
Resolving cookbook dependencies...
Fetching 'artifact' from git://github.com/RiotGames/artifact-cookbook.git (at master)
Fetching 'ctg_cookbook' from source at .
Fetching 'drush' from git://github.com/jenkinslaw/chef-drush.git (at 0a567e2)
Fetching 'php-fpm' from git://github.com/yevgenko/cookbook-php-fpm.git (at master)
Fetching cookbook index from https://api.opscode.com/organizations/createthegood...
D:/opscode/chefdk/embedded/lib/ruby/gems/2.0.0/gems/berkshelf-api-client-1.2.1/lib/berkshelf/api
_client/connection.rb:67:in `block in universe': undefined method `each' for #<String:0x3fdc4e8>
 (NoMethodError)
        from D:/opscode/chefdk/embedded/lib/ruby/gems/2.0.0/gems/berkshelf-api-client-1.2.1/lib/
berkshelf/api_client/connection.rb:66:in `tap'
        from D:/opscode/chefdk/embedded/lib/ruby/gems/2.0.0/gems/berkshelf-api-client-1.2.1/lib/
berkshelf/api_client/connection.rb:66:in `universe'
        from D:/opscode/chefdk/embedded/apps/berkshelf/lib/berkshelf/source.rb:22:in `build_univ
erse'
        from D:/opscode/chefdk/embedded/apps/berkshelf/lib/berkshelf/installer.rb:21:in `block (
2 levels) in build_universe'

但是,knife 在其配置的服务器上找到了该食谱:

C:\Users007>knife cookbook list help
7-zip                  1.0.2
activelamp_composer    0.0.1
activelamp_drupal      0.0.4
activelamp_symfony     0.0.1
al_base                0.0.1

我认为 berkshelf 可能没有从 knife 获取配置信息(比如密钥文件)。但我似乎无法想出一种方法来验证这一点。我尝试诊断此问题的下一步是什么?

我不认为 Hosted Chef 提供了可以在 Berksfile 中使用的 Berkshelf API。 Berkshelf 需要与 berkshelf-api 对话,后者为您所有 Chef Server 的说明书编制索引,然后能够进行依赖项解析。这就是 block in universe 失败的原因,因为在 berkshelf-api 中有一个 /universe API 资源。 Hosted Chef 好像不支持。

通常在您的 Berksfile 中,您将内部 berkshelf-api 放在第一位,然后将社区 berkshelf-api 放在第二位。在这种情况下,社区 api 现在位于 https://supermarket.chef.io。如果您的食谱仅依赖于 Supermarket 上可用的食谱,则您不必设置自己的 Berkshelf API。

如果您打算编写依赖于您自己的食谱的食谱,最好的方法是设置一个 berkshelf-api 服务器。有一本 食谱,您可以设置它并将其指向您的 Hosted Chef 组织。您还可以建立您自己的超市,它也提供伯克货架API。