Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Loading attributes from the data DBI #313

Closed
zhelyan opened this issue Apr 23, 2015 · 1 comment
Closed

Loading attributes from the data DBI #313

zhelyan opened this issue Apr 23, 2015 · 1 comment

Comments

@zhelyan
Copy link

zhelyan commented Apr 23, 2015

Unless I am missing something obvious:

in attributes/data.rb:

data = Chef::DataBagItem.load('elasticsearch', 'data')[node.chef_environment] rescue {}
default.elasticsearch[:data][:devices] = data['devices'] || {}

The first line returns nil, not an empty hash if there is no configuration for the current environment in the data bag; as a result, the 2nd line fails with

NoMethodError: undefined method `[]' for nil:NilClass
/var/cache/chef/cookbooks/elasticsearch/attributes/data.rb:100:in `from_file'
@martinb3
Copy link
Contributor

martinb3 commented Jul 7, 2015

Hello! We've re-written the cookbook using libraries that expose resources and providers, so you shouldn't see this problem on the newer version; it should also be much easier to customize. Hope this helps!

@martinb3 martinb3 closed this as completed Jul 7, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants