gpt4 book ai didi

mysql - Chef 无法安装 MySQL : no resouce, 名为 create 的方法或变量

转载 作者:行者123 更新时间:2023-11-29 12:08:49 25 4
gpt4 key购买 nike

嗨,我正在尝试使用 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: ----------------------

我已经尝试过不同版本的 Recipe ,不同版本的数据库,从头开始一切,以下页面中提出的解决方案 Chef Mysql recipe fails , https://github.com/chef-cookbooks/mysql/issues/332 , https://gist.github.com/faraazkhan/680c3e79c7524be355ca ,但我无法进一步。

我做错了什么?我是否缺少任何配置/参数/属性/依赖项?

谢谢

最佳答案

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

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


mysql_service '默认' 做
端口“3306”
版本“5.7”
初始根密码“你永远不会猜到”
提供商 Chef::Provider::MysqlService::Sysvinit
Action [:创建,:开始]
结尾

关于mysql - Chef 无法安装 MySQL : no resouce, 名为 create 的方法或变量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31051890/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com