sous-chefs / mysql

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

uninitialized constant Chef::Provider::MysqlServiceSysvinit #490

Closed LMtx closed 7 years ago

LMtx commented 8 years ago

Cookbook version

mysql (8.1.1)

Chef-client version

Chef: 12.15.19

Platform Details

CentOS Linux release 7.2.1511 (Core)

Scenario:

I try to manually set the provider.

Steps to Reproduce:

mysql_service node['data']['database']['name'] do
  port '3306'
  version '5.6'
  initial_root_password node['data']['database']['root_rand_p']
  Chef::Provider::MysqlServiceSysvinit
  action [:create, :start]
end

Expected Result:

Service created with correct provider.

Actual Result:

       Recipe Compile Error in /tmp/kitchen/cache/cookbooks/data_data/recipes/default.rb
       ================================================================================

       NameError
       ---------
       uninitialized constant Chef::Provider::MysqlServiceSysvinit

       Cookbook Trace:
       ---------------
         /tmp/kitchen/cache/cookbooks/data_data/recipes/database_setup.rb:34:in `block in from_file'
         /tmp/kitchen/cache/cookbooks/data_data/recipes/database_setup.rb:29:in `from_file'
         /tmp/kitchen/cache/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/run_context.rb:347:in `load_recipe'
         /tmp/kitchen/cache/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/run_context.rb:303:in `block in include_recipe'
         /tmp/kitchen/cache/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/run_context.rb:302:in `each'
         /tmp/kitchen/cache/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/run_context.rb:302:in `include_recipe'
         /tmp/kitchen/cache/cookbooks/data_data/recipes/default.rb:8:in `from_file'
         /tmp/kitchen/cache/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/run_context.rb:347:in `load_recipe'

       Relevant File Content:
       ----------------------
       /tmp/kitchen/cache/cookbooks/data_data/recipes/database_setup.rb:

        27:  end
        28:
        29:  mysql_service node['data_data']['database']['name'] do
        30:    port '3306'
        31:    # package_name 'rh-mysql56-mysql-server'
        32:    version '5.6'
        33:    initial_root_password node['data_data']['database']['root_rand_p']
        34>>   Chef::Provider::MysqlServiceSysvinit
        35:    action [:create, :start]
        36:  end
        37:
        38:  # package %w(ruby-devel rubygems-devel)
        39:
        40:  # Install mysql2 gem
        41:  mysql2_chef_gem 'default' do
        42:    action :install
        43:  end

       Platform:
       ---------
       x86_64-linux
TheNotary commented 7 years ago

After looking over some of my own error logs on a different problem entirely, give this syntax a try:

mysql_service node['data']['database']['name'] do
  port '3306'
  version '5.6'
  initial_root_password node['data']['database']['root_rand_p']
  service_manager "systemd"
  action [:create, :start]
end

Perhaps this service_manager directive should be added to the supermarket documentation page?

tas50 commented 7 years ago

You shouldn't need to specify the service manage. It's automatic unless you have a use case where you want to run sys-v on a systemd host. Just leave it out and things should work fine.

lock[bot] commented 5 years ago

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.