Chef无法安装MySQL:没有名为create的资源,方法或变量

时间:2015-06-25 13:33:02

标签: mysql chef centos6

您好我正在尝试使用Chef

在新的CentOS 6.6上安装MySQL

从项目https://github.com/chef-cookbooks/mysql我打算使用以下脚本

include_recipe 'selinux::disabled'

mysql_service 'default' do
  port '3306'
  version '5.7'
  initial_root_password 'youllneverguess'
  action [:create, :start]
end

metadata.rb看起来像这样

depends 'selinux'
depends 'mysql'

配置不能简单。

当我运行脚本时,这就是我获得的

INFO -- m-01-centos-66:     ================================================================================
INFO -- m-01-centos-66:     Error executing action `create` on resource 'mysql_service[default]'
INFO -- m-01-centos-66:     ================================================================================
INFO -- m-01-centos-66:     
INFO -- m-01-centos-66:     NameError
INFO -- m-01-centos-66:     ---------
INFO -- m-01-centos-66:     No resource, method, or local variable named `create_stop_system_service' for `Chef::Provider::MysqlService ""'
INFO -- m-01-centos-66:     
INFO -- m-01-centos-66:     Cookbook Trace:
INFO -- m-01-centos-66:     ---------------
INFO -- m-01-centos-66:     /tmp/kitchen/cache/cookbooks/mysql/libraries/provider_mysql_service.rb:39:in `block in <class:MysqlService>'
INFO -- m-01-centos-66:     
INFO -- m-01-centos-66:     Resource Declaration:
INFO -- m-01-centos-66:     ---------------------
INFO -- m-01-centos-66:     # In /tmp/kitchen/cache/cookbooks/eon_hadoop/recipes/ranger.rb
INFO -- m-01-centos-66:     
INFO -- m-01-centos-66:      12: mysql_service 'default' do
INFO -- m-01-centos-66:      13:   port '3306'
INFO -- m-01-centos-66:      14:   version '5.7'
INFO -- m-01-centos-66:      15:   initial_root_password 'youllneverguess'
INFO -- m-01-centos-66:      16:   action [:create, :start]
INFO -- m-01-centos-66:      17: end
INFO -- m-01-centos-66:      18: 
INFO -- m-01-centos-66:     
INFO -- m-01-centos-66:     Compiled Resource:
INFO -- m-01-centos-66:     ------------------
INFO -- m-01-centos-66:     # Declared in /tmp/kitchen/cache/cookbooks/eon_hadoop/recipes/ranger.rb:12:in `from_file'
INFO -- m-01-centos-66:     
INFO -- m-01-centos-66:     mysql_service("default") do
INFO -- m-01-centos-66:       action [:create, :start]
INFO -- m-01-centos-66:       retries 0
INFO -- m-01-centos-66:       retry_delay 2
INFO -- m-01-centos-66:       default_guard_interpreter :default
INFO -- m-01-centos-66:       declared_type :mysql_service
INFO -- m-01-centos-66:       cookbook_name "eon_hadoop"
INFO -- m-01-centos-66:       recipe_name "ranger"
INFO -- m-01-centos-66:       port "3306"
INFO -- m-01-centos-66:       version "5.7"
INFO -- m-01-centos-66:       initial_root_password "youllneverguess"
INFO -- m-01-centos-66:       package_action :install
INFO -- m-01-centos-66:     end
INFO -- m-01-centos-66:     
INFO -- m-01-centos-66: 
INFO -- m-01-centos-66: Running handlers:
INFO -- m-01-centos-66: [2015-06-25T13:05:36+00:00] ERROR: Running exception handlers
INFO -- m-01-centos-66: Running handlers complete
INFO -- m-01-centos-66: [2015-06-25T13:05:36+00:00] ERROR: Exception handlers complete
INFO -- m-01-centos-66: Chef Client failed. 2 resources updated in 40.87935617 seconds
INFO -- m-01-centos-66: [2015-06-25T13:05:36+00:00] FATAL: Stacktrace dumped to /tmp/kitchen/cache/chef-stacktrace.out
INFO -- m-01-centos-66: [2015-06-25T13:05:36+00:00] ERROR: mysql_service[default] (eon_hadoop::ranger line 12) had an error: NameError: No resource, method, or local variable named `create_stop_system_service' for `Chef::Provider::MysqlService ""'
INFO -- m-01-centos-66: [2015-06-25T13:05:36+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
ERROR -- m-01-centos-66: Converge failed on instance <m-01-centos-66>.
ERROR -- m-01-centos-66: ------Exception-------
ERROR -- m-01-centos-66: Class: Kitchen::ActionFailed
ERROR -- m-01-centos-66: Message: SSH exited (1) for command: [sh -c '

al-mode --config /tmp/kitchen/client.rb --log_level auto --force-formatter --no-color --json-attributes /tmp/kitchen/dna.json --chef-zero-port 8889

ERROR -- m-01-centos-66: ---Nested Exception---
ERROR -- m-01-centos-66: Class: Kitchen::Transport::SshFailed
ERROR -- m-01-centos-66: Message: SSH exited (1) for command: [sh -c '

al-mode --config /tmp/kitchen/client.rb --log_level auto --force-formatter --no-color --json-attributes /tmp/kitchen/dna.json --chef-zero-port 8889

ERROR -- m-01-centos-66: ------Backtrace-------
ERROR -- m-01-centos-66: C:/opscode/chefdk/embedded/apps/test-kitchen/lib/kitchen/provisioner/base.rb:74:in `rescue in call'
ERROR -- m-01-centos-66: C:/opscode/chefdk/embedded/apps/test-kitchen/lib/kitchen/provisioner/base.rb:77:in `call'
ERROR -- m-01-centos-66: C:/opscode/chefdk/embedded/apps/test-kitchen/lib/kitchen/instance.rb:366:in `block in converge_action'
ERROR -- m-01-centos-66: C:/opscode/chefdk/embedded/apps/test-kitchen/lib/kitchen/instance.rb:488:in `call'
ERROR -- m-01-centos-66: C:/opscode/chefdk/embedded/apps/test-kitchen/lib/kitchen/instance.rb:488:in `synchronize_or_call'
ERROR -- m-01-centos-66: C:/opscode/chefdk/embedded/apps/test-kitchen/lib/kitchen/instance.rb:453:in `block in action'
ERROR -- m-01-centos-66: C:/opscode/chefdk/embedded/lib/ruby/2.1.0/benchmark.rb:279:in `measure'
ERROR -- m-01-centos-66: C:/opscode/chefdk/embedded/apps/test-kitchen/lib/kitchen/instance.rb:452:in `action'
ERROR -- m-01-centos-66: C:/opscode/chefdk/embedded/apps/test-kitchen/lib/kitchen/instance.rb:362:in `converge_action'
ERROR -- m-01-centos-66: C:/opscode/chefdk/embedded/apps/test-kitchen/lib/kitchen/instance.rb:341:in `block in transition_to'
ERROR -- m-01-centos-66: C:/opscode/chefdk/embedded/apps/test-kitchen/lib/kitchen/instance.rb:340:in `each'
ERROR -- m-01-centos-66: C:/opscode/chefdk/embedded/apps/test-kitchen/lib/kitchen/instance.rb:340:in `transition_to'
ERROR -- m-01-centos-66: C:/opscode/chefdk/embedded/apps/test-kitchen/lib/kitchen/instance.rb:138:in `converge'
ERROR -- m-01-centos-66: C:/opscode/chefdk/embedded/apps/test-kitchen/lib/kitchen/command.rb:176:in `public_send'
ERROR -- m-01-centos-66: C:/opscode/chefdk/embedded/apps/test-kitchen/lib/kitchen/command.rb:176:in `block (2 levels) in run_action'
ERROR -- m-01-centos-66: ----------------------

我已经尝试过不同版本的cookbook,数据库的差异版本,从头开始重新启动所有内容,以下页面Chef Mysql recipe failshttps://github.com/chef-cookbooks/mysql/issues/332https://gist.github.com/faraazkhan/680c3e79c7524be355ca中提出的解决方案,但是我再也找不到了。

我做错了什么?我错过了任何配置/参数/属性/依赖??

谢谢

1 个答案:

答案 0 :(得分:1)

似乎由于某种原因mysql_service没有选择正确的provider

尝试将provider Chef::Provider::MysqlService::Sysvinit添加到mysql_service

mysql_service 'default' do port '3306' version '5.7' initial_root_password 'youllneverguess' provider Chef::Provider::MysqlService::Sysvinit action [:create, :start] end