ERROR: can't convert Array into String when using with "oh-my-zsh" cookbook
munjalpatel opened this issue · 2 comments
munjalpatel commented
Hello,
I am getting the following error when I use this cookbook with: https://supermarket.getchef.com/cookbooks/oh-my-zsh#librarian
==> default: [2014-08-09T12:39:30+00:00] ERROR: can't convert Array into String
==> default:
==> default: ================================================================================
==> default: Recipe Compile Error in /tmp/vagrant-chef-3/chef-solo-1/cookbooks/oh-my-zsh/recipes/default.rb
==> default: ================================================================================
==> default:
==> default:
==> default: TypeError
==> default: ---------
==> default: can't convert Array into String
==> default:
==> default:
==> default: Cookbook Trace:
==> default: ---------------
==> default: /tmp/vagrant-chef-3/chef-solo-1/cookbooks/chef-solo-search/libraries/search/overrides.rb:91:in `search_data_bag'
==> default: /tmp/vagrant-chef-3/chef-solo-1/cookbooks/chef-solo-search/libraries/search/overrides.rb:48:in `search'
==> default: /tmp/vagrant-chef-3/chef-solo-1/cookbooks/chef-solo-search/libraries/search.rb:69:in `search'
==> default: /tmp/vagrant-chef-3/chef-solo-1/cookbooks/oh-my-zsh/recipes/default.rb:23:in `from_file'
==> default:
==> default:
==> default: Relevant File Content:
==> default: ----------------------
==> default: /tmp/vagrant-chef-3/chef-solo-1/cookbooks/chef-solo-search/libraries/search/overrides.rb:
==> default:
==> default: 84: end
==> default: 85: end
==> default: 86: return _result
==> default: 87: end
==> default: 88:
==> default: 89: def search_data_bag(_query, bag_name, start, rows, &block)
==> default: 90: _result = []
==> default: 91>> data_bag(bag_name.to_s).each do |bag_item_id|
==> default: 92: bag_item = data_bag_item(bag_name.to_s, bag_item_id)
==> default: 93: if _query.match(bag_item)
==> default: 94: _result << bag_item
==> default: 95: end
==> default: 96: end
==> default: 97: return _result
==> default: 98: end
==> default: 99: end
==> default: 100: end
==> default:
==> default:
==> default:
Can you please help me out here?
jwoertink commented
Interesting, I'm getting this same error, but I'm not using oh-my-zsh. I think the error is in data_bag
. I'm just doing
def data_bag_items(bag_name)
data_bag(bag_name).map { |id| data_bag_item bag_name, id }
end
users = data_bag_items(:users)
==> default: TypeError
==> default: ---------
==> default: can't convert Array into String
==> default:
==> default: Relevant File Content:
==> default: ----------------------
==> default: /tmp/vagrant-chef-5/chef-solo-1/cookbooks/asterisk/recipes/config.rb:
==> default:
==> default: 1: def data_bag_items(bag_name)
==> default: 2>> data_bag(bag_name).map { |id| data_bag_item bag_name, id }
==> default: 3: end
==> default: 4:
==> default: 5: users = data_bag_items(:users)
SamuelDavis commented
I'm having the same error when trying to fetch either a data bag or a data bag item. I agree; it's apparently a problem in the data_bag function itself.