sensu / sensu-go-chef

Chef Library Cookbook for Sensu Go
https://sensu.io
MIT License
11 stars 22 forks source link

Chef-Latest cannot converge sensu_agent and sensu_backend resources #104

Closed kovukono closed 3 years ago

kovukono commented 3 years ago

Chef Version

16.5.77

Input

Sensu Agent calls to_yaml to interpret the hash to a yaml so we can output it to the file. In Chef 16.5.77, this appears to be broken.

sensu_agent 'default' do
  version node['custom_sensu_go']['agent']['version']
  config(
    'backend-url': [ "wss://#{data_bag_item(node['custom_sensu_go']['sensu_data_bag'], 'backend')['endpoint']}:8081" ],
    'cert-file' => "#{cert_dir}/sensu-agent.pem",
    'key-file' => "#{cert_dir}/sensu-agent.key",
    'trusted-ca-file' => "#{cert_dir}/sensuca.pem",
    'api-port': '4041',
    'socket-port': '4030',
    'keepalive-handlers': node['custom_sensu_go']['agent']['keepalive']['handlers'],
    'keepalive-critical-timeout': node['custom_sensu_go']['agent']['keepalive']['timeout'],
    'deregister': node['custom_sensu_go']['agent']['deregister'],
    'log-level': node['custom_sensu_go']['agent']['log-level']
  )
end

Output

          * sensu_agent[default] action install

            ================================================================================
            Error executing action `install` on resource 'sensu_agent[default]'
            ================================================================================

            NoMethodError
            -------------
            undefined method `to_yaml' for #<Hash:0x0000000004cdc8d8>

            Cookbook Trace: (most recent call first)
            ----------------------------------------
            /tmp/kitchen/cache/cookbooks/sensu-go/resources/agent.rb:60:in `block (2 levels) in class_from_file'
            /tmp/kitchen/cache/cookbooks/sensu-go/resources/agent.rb:59:in `block in class_from_file'

Impact

Chef-Latest runs are now failing for sensu-go-chef, for agents and backends.

Expected Behavior

The resource converges normally.

Actual Behavior

The resource throws an error.

Steps to Reproduce your problem

  1. Run KITCHEN_LOCAL_YAML=.kitchen.dokken.yml bundle exec kitchen converge default-ubuntu-1604
tmonk42 commented 3 years ago

Looks like this is probably related: https://github.com/chef/chef/issues/10470

majormoses commented 3 years ago

This certainly seems like the upstream bug, I saw similar in another project and we pinned it at 16.4 until we had a solution. I have not tested it but we could try that include/require that worked in the new windows pr.

webframp commented 3 years ago

That looks like it. I'll have dev time coming up over this next week/weekend to work through a bunch of the current issues

tmonk42 commented 3 years ago

https://github.com/chef/chef/issues/10492#issuecomment-705717505