Chef Kitchen 在 Windows 的 'kitchen converge' 期间找不到当前食谱

Chef Kitchen can't find current cookbook during 'kitchen converge' on Windows

我有一本工作正常的食谱,然后我更新到最新版本的厨房,现在它在收敛期间抛出错误。我试过在一本没有任何依赖关系的食谱上进行聚合,但效果很好,所以我猜这可能与 berks 有关?

编辑:失败的行是:

$env:systemdrive\opscode\chef\bin\chef-client.bat --local-mode --config $env:TEMP\kitchen\client.rb --log_level auto --force-formatter --no-color --json-attributes $env:TEMP\kitchen\dna.json --chef-zero-port 8889

在 WindowsServer 2012 RC2 VirtualBox 上 运行。通过查看临时目录中的 kitchen 文件夹,似乎 none 的食谱正在被复制到虚拟机中。

当我 运行 收敛一个没有依赖项的简单测试食谱时,我可以看到虚拟机上的厨房文件夹中有食谱文件夹,收敛成功。

编辑 2:

我在工作手册中添加了一个依赖项,添加了一个 Berksfile(与此 post 底部的那个相同)并执行了 berks install 并引发了 SSL_connect 错误

C:/tools/ruby22/lib/ruby/gems/2.2.0/gems/httpclient-.7.2/lib/httpclient/ssl_socket.rb:46:in `connect': SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (Faraday::SSLError)

这与post中的错误相同:https://github.com/chef/chef-dk/issues/106

运行 powershell 修复是:

Invoke-WebRequest http://curl.haxx.se/ca/cacert.pem -OutFile c:\cacert.pem
Set-Item -Path env:SSL_CERT_FILE -Value C:\cacert.pem

解决了错误,但是在 运行ning kitchen converge 之后我 运行 进入了同样的问题,我在虚拟机上没有食谱。我现在很确定这两个问题是相关的。

下面有更多详细信息


这些是我目前使用的版本:

Chef Development Kit Version: 0.12.0
chef-client version: 12.9.38
berks version: 4.3.2
kitchen version: 1.7.3

这是错误(mock_emr 是我试图收敛的食谱的名称):

-----> Starting Kitchen (v1.7.3)
-----> Converging <default-windows-2012r2>...
       Preparing files for transfer
       Preparing dna.json
       Resolving cookbook dependencies with Berkshelf 4.3.2...
       Removing non-cookbook files before transfer
       Preparing data_bags
       Preparing validation.pem
       Preparing client.rb
-----> Chef Omnibus installation detected (install only if missing)

       Creating the scheduled task.
       SUCCESS: The scheduled task "chef-tk" has successfully been created.
       Transferring files to <default-windows-2012r2>
       SUCCESS: Attempted to run the scheduled task "chef-tk".
       Connected to the scheduled task.
       Starting Chef Client, version 12.9.38
       resolving cookbooks for run list: ["mock_emr::default"]

       ================================================================================
       Error Resolving Cookbooks for Run List:
       ================================================================================

       Missing Cookbooks:
       ------------------
       No such cookbook: mock_emr

       Expanded Run List:
       ------------------
       * mock_emr::default

       Platform:
       ---------
       x64-mingw32


       Running handlers:
       [2016-04-25T15:57:51+00:00] ERROR: Running exception handlers
       Running handlers complete
       [2016-04-25T15:57:51+00:00] ERROR: Exception handlers complete
       Chef Client failed. 0 resources updated in 34 seconds
       [2016-04-25T15:57:51+00:00] FATAL: Stacktrace dumped to C:/Users/vagrant/AppData/Local/Temp/kitchen/cache/chef-st
acktrace.out
       [2016-04-25T15:57:51+00:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug repor
t
       [2016-04-25T15:57:51+00:00] FATAL: Net::HTTPServerException: 412 "Precondition Failed"

我的 .kitchen.yml 文件是这样的:

---
driver:
  name: vagrant
  network:
    - ["private_network", {ip: "192.168.35.35"}]
  synced_folders:
    - ["../../.chef/secrets", "C:/chef"]

provisioner:
  name: chef_zero_scheduled_task

platforms:
  - name: windows-2012r2
    driver:
      customize:
        memory: 2048

suites:
  - name: default
    data_bags_path: "../../data_bags"
    run_list:
      - recipe[mock_emr::default]
    attributes:
      mock_emr:
        secret_file: 'C:/chef/encrypted_data_bag_secret'
      sql_server:
        sysadmins: ['Administrator', 'vagrant']

和 metadata.rb 文件:

name 'mock_emr'
maintainer 'The Authors'
maintainer_email 'author@example.com'
license 'all_rights'
description 'Installs/Configures mock_emr'
long_description 'Installs/Configures mock_emr'
version '0.1.0'

depends 'sql_server', '~> 2.5.0'
depends 'iis', '~> 4.1.6'

和 berksfile:

source 'https://supermarket.chef.io'

metadata

我认为这是安装 ruby 以及 Chef 开发工具包的问题。我认为 chef 试图 运行 通过 ruby 而不是开发工具包,并且遇到了问题。我卸载了 ruby 和开发工具包,并重新安装了开发工具包,现在一切似乎都正常工作了。

让我得出这个结论的线索是 运行ning chef verify 失败说 omnibus 配置不正确。