I have the following code in my recipe but it errors.
log "###" + cookbook_name + "::" + recipe_name + " " + Time.now.inspect + ": Starting execution phase"
puts "###" + cookbook_name + "::" + recipe_name + " " + Time.now.inspect + ": Starting compile phase"
The error is:
TypeError: no implicit conversion of Symbol into String
/test/chef/cookbooks/cookbook-server/recipes/setup_server.rb:10:in `+'
The issue seems to be with the cookbook_name
, recipe_name
etc.(the ones which are not hardcoded). Please help.
When you're doing
+
action with the strings in Ruby, it doesn't convert other types to strings. If you want from Ruby to do that automatically, you need to do interpolation like:If you want to use
+
you need to provide all variables as strings:I suggest you to use first method.