Chef Kitchen在Windows上的“厨房融合”期间找不到当前的食谱

时间:2016-04-25 16:19:02

标签: windows vagrant chef berkshelf test-kitchen

我有一本工作正常的食谱,然后我更新到最新版本的厨房,现在它在聚合期间抛出错误。我已经尝试过对没有任何依赖关系并且工作正常的食谱进行收敛,所以我猜这可能与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文件夹,看起来没有任何cookbook被复制到虚拟机。

当我在一个简单的测试食谱上运行时,没有任何依赖性,我可以看到虚拟机上的厨房文件夹有cookbook文件夹,并且汇聚成功。

编辑2:

我在工作食谱中添加了一个依赖项,添加了一个Berksfile(与本文底部的相同)并且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)

与此帖中的错误相同: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

解决了错误,但是在运行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

1 个答案:

答案 0 :(得分:0)

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

导致我得出这个结论的线索是,chef verify运行失败,说没有正确配置omnibus。