My custom providers are not working with Chef Client >16

Hello!

I have custom AWS provider for Chef. It's working with Chef Client 12, but can't working with Client 16+.

I added "provides = :amazon" to code, but it didn't help.

AWS resurce:

class Chef
class Resource
class Amazon < Chef::Resource

   provides = :amazon

 def initialize(name, run_context=nil)
   super(name, run_context)
   @resource_name = :amazon
   @provider = Chef::Provider::Amazon
 end

AWS provider:

   require 'chef/provider'
   require 'logger'

      class Chef
       class Provider
         class Amazon < Chef::Provider

        def initialize(new_resource, run_context)
            super

            require 'aws-sdk-core'
            logger = nil
            log_level = :info
            trace = false
            if Chef::Config[:log_level] == :debug
                logger = Logger.new(Chef::Config[:log_location])
                log_level = :debug
                trace = true
            end

Any idea ?

Could you try it as provides :amazon instead (without the =)?

1 Like

You could also try running cookstyle with the --only Chef/Deprecations flag to see what other things may be failing in a move from 12 to 16 due to deprecations.

You are absolutely right!

It took me 2 days to find this :cry: