【发布时间】:2016-04-25 16:19:02
【问题描述】:
我有一本运行良好的食谱,然后我更新到最新版本的厨房,现在它在收敛期间抛出错误。我已经尝试在没有任何依赖项且运行良好的食谱上进行收敛,所以我猜这可能与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 上运行。通过查看 temp 目录中的 kitchen 文件夹,似乎没有任何食谱被复制到虚拟机中。
当我对一个没有依赖关系的简单测试食谱运行收敛时,我可以看到虚拟机上的厨房文件夹有食谱文件夹,并且收敛成功。
编辑 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
【问题讨论】:
-
这本食谱的
metadata.rb(运行kitchen)真的声明了cookbook_name "mock_emr"?或者metadata.rb中有什么内容? -
berks install工作吗? -
Berks 安装运行结果如下:
Resolving cookbook dependencies... Fetching 'mock_emr' from source at . Using chef_handler (1.3.0) Using iis (4.1.7) Using mock_emr (0.1.0) from source at . Using sql_server (2.5.0) Using windows (1.39.2) -
我也得到了这里看到的错误github.com/chef/chef-dk/issues/106,但是在使用了解决方法之后它就消失了。我认为这可能与当前的错误有关,但我不确定。
-
如果您在同一目录中有
Berksfile,请也包含它。
标签: windows vagrant chef-infra berkshelf test-kitchen