chef-boneyard / ohai

Development repository for Chef Cookbook ohai

Home Page:https://supermarket.chef.io/cookbooks/ohai

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

rescue in load_current_resource

scalp42 opened this issue · comments

Using newest aws cookbook, I'm seeing the following:

Recipe: aws::ec2_hints
  * ohai_hint[ec2] action create/var/chef/cache/cookbooks/ohai/providers/hint.rb:31:in `rescue in load_current_resource'
/var/chef/cache/cookbooks/ohai/providers/hint.rb:28:in `load_current_resource'
/var/chef/cache/cookbooks/aws/recipes/ec2_hints.rb:22:in `from_file'
/var/chef/cache/cookbooks/gz-consul/recipes/aws.rb:13:in `from_file'
/var/chef/cache/cookbooks/gz-consul/recipes/default.rb:51:in `from_file'
/var/chef/cache/cookbooks/gz-dns/recipes/consul.rb:18:in `from_file'
/var/chef/cache/cookbooks/gz-dns/recipes/consul_hosts_getter.rb:10:in `from_file'
/var/chef/cache/cookbooks/gz-dns/recipes/default.rb:12:in `from_file'
/var/chef/cache/cookbooks/gz-common/recipes/dns.rb:10:in `from_file'
/var/chef/cache/cookbooks/gz-common/recipes/default.rb:19:in `from_file'
/var/chef/cache/cookbooks/gz-elastic-role/recipes/default.rb:10:in `from_file'
/var/chef/cache/cookbooks/gz-elastic-role/recipes/main.rb:13:in `from_file'
/opt/chef/embedded/lib/ruby/2.1.0/forwardable.rb:183:in `setup_run_context'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.6.0/bin/chef-client:26:in `<top (required)>'
/usr/bin/chef-client:54:in `load'
/usr/bin/chef-client:54:in `<main>'
 (up to date)
  * ohai[reload] action reload
    - re-run ohai and merge results into node attributes

Looks it's a warning for Chef 13:

Deprecated features used!
  content nil currently does not overwrite the value of content. This will change in Chef 13, and the value will be set to nil instead. Please change your code to explicitly accept nil using "property :content, [MyType, nil]", or stop setting this value to nil. at 1 location:
    - /var/chef/cache/cookbooks/ohai/providers/hint.rb:31:in `rescue in load_current_resource'

@scalp42 What's currently in your ec2 hint file?

@scalp42 Also what version of the Ohai cookbook are you running?

@tas50

ec2 hint file is empty:

root@cassandra-auth-i-8d4dee57 [gz-prod] ~ # cat /etc/chef/ohai/hints/ec2.json
root@cassandra-auth-i-8d4dee57 [gz-prod] ~ #
root@cassandra-auth-i-8d4dee57 [gz-prod] ~ # cat /var/chef/cache/cookbooks/ohai/metadata.json  | jq .version
"2.0.4"
root@cassandra-auth-i-8d4dee57 [gz-prod] ~ # chef-client --version
Chef: 12.6.0

It looks like we have a few different problems with this provider. I just added a test for hints without content and I'm looking at ripping out most of the code in the current provider. Thanks for the report. This is certainly broken at the moment.

@tas50 no worries at all, aws cookbook being picked up again is already 🍬

I just release 2.1.0 with a fix for the empty content issue and I added testing to make sure that one doesn't come back. I'll release a new aws cookbook with the same tests and a dependency on Ohai 2.1.0+

Much appreciated @tas50 ! :hugops:

That one was a lot of fun to fix actually. Super broken and in need of tests. Feel free to find as many of those as you can.