dd-handler recipe fails convergence due to extra_endpoints
Opened this issue · 0 comments
haidangwa commented
We are wrapping this cookbook and in one of our recipes, we're issuing include_recipe 'datadog::dd-handler'. The chef run fails with only the values set by the datadog cookbook's default attribute
node['datadog']['extra_endpoints']`.
chef version : 15.6.10
platform: Redhat 8
Seems if I set node.force_override['datadog']['extra_endpoints'] = {}
I am able to avoid this problem. Setting this at other node levels, like override
and force_default
, seem to have no affect.
This might be related to #451 ; however in this case, our wrapper script is not setting anything to extra_endpoints -- merely using the defaults.
Error output:
Recipe: datadog::dd-handler
* chef_gem[chef-handler-datadog] action install[2019-12-19T19:30:55+00:00] INFO: Processing chef_gem[chef-handler-datadog] action install (datadog::dd-handler line 34)
[2019-12-19T19:30:57+00:00] INFO: chef_gem[chef-handler-datadog] installed chef-handler-datadog at 0.12.3
- install version 0.12.3 of package chef-handler-datadog
* chef_handler[Chef::Handler::Datadog] action enable[2019-12-19T19:30:57+00:00] INFO: Processing chef_handler[Chef::Handler::Datadog] action enable (datadog::dd-handler line 53)
================================================================================
Recipe Compile Error in /home/cloud-user/cache/cookbooks/etech_splunk_datadog/recipes/default.rb
================================================================================
NoMethodError
-------------
undefined method `each' for nil:NilClass
Cookbook Trace:
---------------
/home/cloud-user/cache/cookbooks/datadog/recipes/dd-handler.rb:56:in `extra_endpoints'
/home/cloud-user/cache/cookbooks/datadog/recipes/dd-handler.rb:79:in `handler_config'
/home/cloud-user/cache/cookbooks/datadog/recipes/dd-handler.rb:93:in `block (2 levels) in from_file'
/home/cloud-user/cache/cookbooks/datadog/recipes/dd-handler.rb:101:in `from_file'
/home/cloud-user/cache/cookbooks/etech_splunk_datadog/recipes/default.rb:65:in `block in from_file'
/home/cloud-user/cache/cookbooks/etech_splunk_datadog/recipes/default.rb:64:in `each'
/home/cloud-user/cache/cookbooks/etech_splunk_datadog/recipes/default.rb:64:in `from_file'
Relevant File Content:
----------------------
/home/cloud-user/cache/cookbooks/datadog/recipes/dd-handler.rb:
49: ENV['DATADOG_PROXY'] = proxy_url.to_s
50: end
51:
52: # Create the handler to run at the end of the Chef execution
53: chef_handler 'Chef::Handler::Datadog' do
54: def extra_endpoints
55: extra_endpoints = []
56>> node['datadog']['extra_endpoints'].each do |_, endpoint|
57: next unless endpoint['enabled']
58: endpoint = Mash.new(endpoint)
59: endpoint.delete('enabled')
60: extra_endpoints << endpoint
61: end
62: extra_endpoints
63: end
64:
65: def handler_config
System Info:
------------
chef_version=15.6.10
platform=redhat
platform_version=8.1
ruby=ruby 2.6.5p114 (2019-10-01 revision 67812) [x86_64-linux]
program_name=/opt/chef/bin/chef-client
executable=/opt/chef/bin/chef-client