Hi All,
I am getting this error when running a simple cookbook with attribute:
TypeError
no implicit conversion of String into Integer
Relevant File Content:
/var/chef/cache/cookbooks/temp_test/recipes/default.rb:
19:
20: node[“test”][“sitename”].each do |data1|
21: template “/home/ec2-user/newwwww.txt” do
22: source "template_test.erb"
23: mode "0755"
24: owner "root"
25: group "ec2-user"
26>> variables(:nam => data1[‘names’])
27: end
28: end
29:
This is attribute config:
[ec2-user@Splunk-Server recipes] cat ../attributes/default.rb default[:chef][:site][:com] = { 'port' => '8080', 'ssl' => 'yes'}; default[:chef][:site][:de] = { 'port' => '8081', 'ssl' => 'no'}; default[:chef][:site][:it] = { 'port' => '8082', 'ssl' => 'yes'}; **default[:test][:sitename] = { 'nam' => 'testattribute','value' => 'yes'}** [ec2-user@Splunk-Server recipes]
This is the recipe config:
node[“chef”][“site”].each do |sitename, data|
template “/home/ec2-user/#{sitename}.txt” do
source "template_test.erb"
mode "0755"
owner "root"
group "ec2-user"
variables(:site_name => sitename, :port => data[‘port’], :ssl => data[‘ssl’])
end
end
node[“test”][“sitename”].each do |data1|
template “/home/ec2-user/newwwww.txt” do
source "template_test.erb"
mode "0755"
owner "root"
group "ec2-user"
variables(:nam => data1[‘names’])
end
end
I am not able to find out what is the error in my config. Any help would be appreciated!
Krish