Provider not found after chef-client 12.5.1 for custom resource

I’ve got an older cookbook, ips, that provides a resource. The resource definition is in the libraries directory.

require 'chef/resource’
class Chef
class Resource
class IpsPublisher < Chef::Resource
def initialize(name, run_context = nil)
etc.

The provider definition is in the provider directory in file publisher.rb. It defines load_current_resource and a couple actions, nothing special about it.

When I use the ips_publisher resource, along with chef-client >= 12.5.1, in a recipe I get

       Chef::Exceptions::ProviderNotFound
       ----------------------------------
       Cannot find a provider for ips_publisher[Solaris default with proxy] on solaris2 version 5.11

Undocumented breaking change in 12.5.1 maybe? Is there anyway to get the publisher recognized?

Thanks,
Mark

so the error is about not being able to find the provider, but you’ve copypasta’d the resource code.

you should be using provides :ips_publisher in both the provider and resource code. in the provider code you can protect that with a if responds_to?(:provides) check if you really still need chef-11 compat.

in general library resources and providers are officially discouraged:

https://docs.chef.io/custom_resources_notes.html

Thanks. I rewrote the library resource code as a lwrp resource. The rspec tests that depended on the library resource was the only reason for using library code. Rewrote the tests too.