sous-chefs / mysql

Development repository for the mysql cookbook
https://supermarket.chef.io/cookbooks/mysql
Apache License 2.0
337 stars 691 forks source link

release 8.7.2 is incompatible with chef-client 12 #632

Closed pdohertybcov closed 4 years ago

pdohertybcov commented 4 years ago

:speaking_head: Foreword

release 8.7.2 produces fatal errors with chef-client 12

:ghost: Brief Description

PR #631 appears to have broken this cookbook for Chef-Client 12 (specifically I'm using 12.21.14)

I get this

       Chef::Exceptions::InvalidResourceSpecification
       ----------------------------------------------
       [default].resource_name is `nil`!  Did you forget to put `provides :blah` or `resource_name :blah` in your resource class?

:pancakes: Cookbook version

8.7.2

:woman_cook: Chef-Infra Version

12.21.14

:tophat: Platform details

CentOS 7.8.2003

Steps To Reproduce

Steps to reproduce the behavior: Using chef-client 12, create a simple call to the resource.

mysql_service 'default' do
  action [:create, :start]
  bind_address '127.0.0.1'
  version '5.7'
  initial_root_password 'password'
end

Test Kitchen will fail with the error above.

:police_car: Expected behavior

It should converge without errors, like it did in release 8.7.1

:heavy_plus_sign: Additional context

If you're dropping support for chef-client 12, then the cookbook should see a minor or major version change, and the readme needs updating.

Thanks!

pdohertybcov commented 4 years ago

It looks like Cookstyle 6.8 fixes this, by using both provides and resource_name to maintain compatibility with Chef Client 15 and earlier.

From the Cookstyle release notes:

Chef Infra Client 16.2 contains additional changes to how resource names are specified in order to avoid edge cases in resource naming. When setting the name of a custom resource provides should now be used instead of resource_name. If writing cookbooks that support Chef Infra Client < 16 you'll want to use both provides and resource_name to support all releases.

To support these changes we've made several updates to existing cops. The ChefDeprecations/ResourceUsesOnlyResourceName cop has been updated to add provides in addition to resoure_name instead of replacing resource_name with provides. This change ensures cookbooks continue to function on Chef Infra Client less than 16. The ChefDeprecations/ResourceWithoutNameOrProvides cop has also been renamed to ChefDeprecations/HWRPWithoutProvides and improves detection of resources without provides. Both cops now better validate the contents of existing provides calls.
kleini commented 4 years ago

We're using Cinc 15 and are stumbling over the same problem, too.

sidxz commented 4 years ago

I am getting the same error with chef-client 14 chef_version=14.15.6 platform=centos platform_version=7.8.2003

[2020-07-21T17:05:31-05:00] FATAL: Chef::Exceptions::InvalidResourceSpecification: [ins_1].resource_name is nil! Did you forget to put provides :blah or resource_name :blah in your resource class?