I've recreated all of this in irb.
bootstrap_files is an array, but becomes a multi-dimensional array when Gem.find_files returns another array. The << operator adds the File.join strings to the array.
>> bootstrap_files = []
=> []
>> bootstrap_files << "one_file"
=> ["one_file"]
>> bootstrap_files << "two_file"
=> ["one_file", "two_file"]
>> bootstrap_files << [ "more_files", "and_more_files" ]
=> ["one_file", "two_file", ["more_files", "and_more_files"]]
Using the += operator flattens it, not converts it to a String.
>> bootstrap_files += [ "more_files", "and_more_files" ]
=> ["one_file", "two_file", "more_files", "and_more_files"]
The equivalent of this action, but more explicitly with bootstrap_files.flatten!, was fixed in 0.10.6 in CHEF-2193.
The issue ends up being that when we loop over bootstrap_files and it is unflattened, we end up passing an array to the loop that evaluates if a file exists.
>> Array(bootstrap_files).find do |bootstrap_template|
?> File.dirname(bootstrap_template)
>> File.exists?(bootstrap_template)
>> end
TypeError: can't convert Array into String
from (irb):9:in `dirname'
from (irb):9
from (irb):11:in `find'
from (irb):8:in `each'
from (irb):8:in `find'
from (irb):8
This error only comes up if your template isn't find in the normal places and find gets all the way to the end of the top array where the array from Gem.find_files comes from. This also means that you will get this error on 0.10.4 if you template doesn't exist at all.
Regardless, it is fixed in CHEF-2193.
Basically, it's a ticket for that issue+pull request: https://github.com/opscode/chef/pull/169#issuecomment-3106841.
Pull from: https://github.com/fiksu/chef/commit/6f6e5eacac30acf4d0753577adb8442b61f265dd