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

dd-handler recipe fails convergence due to extra_endpoints #672

Open
haidangwa opened this issue Dec 19, 2019 · 0 comments
Open

dd-handler recipe fails convergence due to extra_endpoints #672

haidangwa opened this issue Dec 19, 2019 · 0 comments

Comments

@haidangwa
Copy link

haidangwa commented Dec 19, 2019

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
           
@haidangwa haidangwa changed the title dd-handler fails convergence due to extra_endpoints dd-handler recipe fails convergence due to extra_endpoints Dec 19, 2019
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

1 participant