1
votes

After Chef Development Kit installation on a node, I got an error during the bootstrap of this node:

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.

With chef-client 11 the cookbook run without problems

default[:packages] = %w( sysstat screen mlocate telnet nmap openssl vim )

Any idea how to fix it?

Thanks!

2

2 Answers

0
votes

You made node['packages'] be a hash instead of an array. You want this code instead:

node['packages'].each do |name, something|
  package name do
    action :upgrade
  end
end

You should also probably check what the something is in your data. Might just be a boolean, or could be a package version, depends on how you set things up elsewhere.

0
votes
%w[ sysstat screen mlocate telnet nmap openssl vim ].each do |pkg|
  package pkg
end