在节点上安装Chef Development Kit后,我在此节点的引导过程中出错:
Chef Development Kit Version: 0.15.16
chef-client version: 12.11.18
delivery version: master (444effdf9c81908795e88156c43b5f)
berks version: 4.3.5
kitchen version: 1.10.0
Compiling Cookbooks...
WARN: Chef::Provider::AptRepository already exists! Cannot create deprecation class for LWRP provider apt_repository from cookbook apt
WARN: AptRepository already exists! Deprecation class overwrites Custom resource apt_repository from cookbook apt
================================================================================
Recipe Compile Error in /var/chef/cache/cookbooks/base/recipes/default.rb =============================================================
TypeError
can't convert Chef::Node::VividMash to String (Chef::Node::VividMash#to_str gives Chef::Node::VividMash)
Cookbook Trace:
/var/chef/cache/cookbooks/base/recipes/packages.rb:10:in `block in from_file'
Relevant File Content:
var/chef/cache/cookbooks/base/recipes/packages.rb:
3: # Recipe:: app
node['packages'].each do |name|
10>> package name do
11: action :upgrade
12: end
13: end
14:
15:
Running handlers:
ERROR: Running exception handlers
6 Running handlers complete
ERROR: Exception handlers complete
FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
ERROR: can't convert Chef::Node::VividMash to String (Chef::Node::VividMash#to_str gives Chef::Node::VividMash)
FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
[SSH] ERROR: Read from remote host : An existing connection was forcibly closed by the remote host.
[SSH] FAIL: Write failed: An existing connection was forcibly closed by the remote host.
Chef Server 11。
使用chef-client 11,食谱可以毫无问题地运行
default[:packages] = %w( sysstat screen mlocate telnet nmap openssl vim )
知道怎么解决吗?
谢谢!
答案 0 :(得分:0)
您使node['packages']
成为哈希而不是数组。你想要这个代码:
node['packages'].each do |name, something|
package name do
action :upgrade
end
end
您还应该查看数据中something
的内容。可能只是一个布尔值,或者可能是一个包版本,取决于你在其他地方设置的方式。
答案 1 :(得分:0)
%w[ sysstat screen mlocate telnet nmap openssl vim ].each do |pkg|
package pkg
end