-
Notifications
You must be signed in to change notification settings - Fork 213
ERROR: TypeError: can't convert Array into String #278
Comments
Ouch. Sorry about that @daachi. Definitely get in touch asap next time. I feel bad having wasted your time like that. Just doing some code browsing, it looks like this is probably coming out of solo_cook.rb:118 since it looks like Pathname.new can throw this. Example from ruby 2.0:
Can you post your librarian and berkshelf version as well? That might help in diagnosing. |
I had this issue when I was setting role_path like cookbook path is set, with an array (in my .chef/knife.rb file), once I made sure role_path was just a string, it worked fine. The same issue could occur with data_bag_path. I think the wiki for updating to 0.3.0 was a bit misleading because role_path was nil, so it wasn't clear what the format of that should be if you want it to be non-nil. Maybe if I was more familiar with the knife.rb file I'd know that, but after only using chef solo, I've never had to mess with it much. Hope this helps |
@danivovich mind mosting your knife.rb for sake of completeness? Feel free to redact any sensitive names. I'd say this is still an "issue" in that we should at least offer a better error. Looks like some some folks also think that role path should be an array. |
.chef/knife.rb current_dir = File.dirname(__FILE__)
cookbook_path ["#{current_dir}/../cookbooks"]
role_path "#{current_dir}/../roles"
data_bag_path "#{current_dir}/../data_bags" |
was it previously like this? role_path ["#{current_dir}/../roles"] |
yes sorry, I should have posted the before and after. My natural tendency here was to copy the existing line I had, which was just cookbook_path part (and the current_dir assignment) |
Sorry I have not had the chance to test this again yet. FWIW, cookbook_path and role_path are arrays, as in the other example (which I think is pretty standard, no?) Anyway, once I get some other stuff finished up, I'll be testing the new version again in the next day or so. Sorry for the grumpy original post; other than this, the solo plugin has been awesomely awesome. |
Yeah, chef-solo does not accept arrays for role_path (only for cookbook_path), so knife-solo does neither. But for sure an array could be detected and a better error message shown. @danivovich btw, you can use relative paths (rooting from the kitchen root) in knife.rb, e.g. |
How about #300 for a fix? |
The CHEF-2928 Mat linked made it to Chef 11.8.0. So chef-solo accepts arrays for |
I don't want to spend too much time on cleaning up shortcomings in chef -Mat about.me/matschaffer On Fri, Nov 8, 2013 at 11:37 AM, Teemu Matilainen
|
Well, not possible in this case as the current and future versions support Arrays, but old one won't. And many will stick to Chef < 11.8 for a long time still.
Sure. Let's see if someone even explains the case why they need multiple role directories. =) |
just for the feedback: if you getting this error, please check that you in chef-repo directory. |
I am getting this error and the only thing I have as an array is the cookbook_path. I'm sure I'm doing something wrong, if you guys could lead me in the right direction, I would appreciate it. cookbook_path ["./cookbooks", "/Users/yannickdawant/.berkshelf/cookbooks"] Log files in the gist. |
thanks @tmatilai! That seemed to work, and I did get it to work just pointing to berkshelf's repo before, I was more curious as to why I couldn't do the array if I wanted to, because I knew that I should be able to. At any rate, your fix worked. I appreciate it! |
2 years later - thank you @tmatilai! |
Another thanks to @tmatilai ! I ended up using this in |
I've come to rely on knife solo and for months it has worked without issue. Recently I rebuilt my gemset and version 0.3.0 was installed, and now knife solo simply doesn't work. Everything I've tried so far results in this error locally.
When I try to run chef-solo -j dna.json on an instance where the 'kitchen' has been uploaded I get an error message that the cookbooks can't be found.
I've spent about two full days trying to figure out how to get this working and am giving up at this point.
The text was updated successfully, but these errors were encountered: