Hello.
I come with another issue.
I want to create a file from template using instances
variable. The attribute file looks like:
default['super']['a']['destination'] = 'a'
default['super']['a']['autorestart'] = 'true'
default['super']['a']['logfile_maxbytes'] = '5MB'
default['super']['a']['logfile_backups'] = 10
default['super']['b']['destination'] = 'b'
default['super']['b']['autorestart'] = 'true'
default['super']['b']['logfile_maxbytes'] = '6MB'
default['super']['b']['logfile_backups'] = 12
default['super']['c']['destination'] = 'c'
default['super']['c']['autorestart'] = 'true'
default['super']['c']['logfile_maxbytes'] = '15MB'
default['super']['c']['logfile_backups'] = 100
And the template defining in the recipe is this:
template 'super.conf' do
path "/etc/super.conf"
source "super.conf.erb"
owner 'user'
group 'user'
mode "0644",
variables(
:instances => node['super']
)
end
The error I get is this:
ArgumentError
-------------
wrong number of arguments (2 for 0..1)
Cookbook Trace:
---------------
/var/chef/cache/cookbooks/app/recipes/default.rb:44:in `block in from_file'
/var/chef/cache/cookbooks/app/recipes/default.rb:39:in `from_file'
Relevant File Content:
----------------------
/var/chef/cache/cookbooks/app/recipes/default.rb:
37: end
38:
39: template 'super.conf' do
40: path "/etc/super.conf"
41: source "super.conf.erb"
42: owner 'user'
43: group 'user'
44>> mode "0644",
45: variables(
46: :instances => node['super']
47: )
48: end
Running handlers:
[2016-05-24T08:18:42+00:00] ERROR: Running exception handlers
Running handlers complete
[2016-05-24T08:18:42+00:00] ERROR: Exception handlers complete
Chef Client failed. 0 resources updated in 05 seconds
[2016-05-24T08:18:42+00:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
[2016-05-24T08:18:42+00:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
[2016-05-24T08:18:42+00:00] ERROR: wrong number of arguments (2 for 0..1)
[2016-05-24T08:18:42+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
Any thoughts, please?
Thank you,
Gabriel