我正在使用最新的Chef' MYSQL' Centos7上的配方需要像这样的标准角色
name "lamp"
description "A full lamp server"
run_list "recipe[apache2]",
"recipe[apache2::mod_php5]",
"recipe[apache2::logrotate]",
"recipe[yum]",
"recipe[yum-epel]",
"recipe[mysql::client]",
"recipe[mysql::server]"
override_attributes({
"starter_name" => "Jonathan Tizard",
"mysql" => {
"server_root_password" => 'iloverandompasswordsbutthiswilldo',
"server_repl_password" => 'iloverandompasswordsbutthiswilldo',
"server_debian_password" => 'iloverandompasswordsbutthiswilldo'
}
})
但是我收到以下错误,我错过了一些明显的东西吗?我无法弄清楚它失败的原因。我想我还没有定义变量或某事物?
Recipe: mysql::server
* mysql_service[default] action create
Recipe: yum-mysql-community::mysql55
* yum_repository[mysql55-community] action create
* template[/etc/yum.repos.d/mysql55-community.repo] action create (up to date)
* execute[yum-makecache-mysql55-community] action nothing (skipped due to action :nothing)
* ruby_block[yum-cache-reload-mysql55-community] action nothing (skipped due to action :nothing)
(up to date)
- evaluate block and run any associated actions
================================================================================
Error executing action `create` on resource 'mysql_service[default]'
================================================================================
ArgumentError
-------------
You must supply a name when declaring a package resource
Cookbook Trace:
---------------
/var/chef/cache/cookbooks/mysql/libraries/provider_mysql_service_rhel.rb:168:in `block (2 levels) in <class:Rhel>'
/var/chef/cache/cookbooks/mysql/libraries/provider_mysql_service_rhel.rb:153:in `block in <class:Rhel>'
Resource Declaration:
---------------------
# In /var/chef/cache/cookbooks/mysql/recipes/server.rb
20: mysql_service node['mysql']['service_name'] do
21: version node['mysql']['version']
22: port node['mysql']['port']
23: data_dir node['mysql']['data_dir']
24: server_root_password node['mysql']['server_root_password']
25: server_debian_password node['mysql']['server_debian_password']
26: server_repl_password node['mysql']['server_repl_password']
27: allow_remote_root node['mysql']['allow_remote_root']
28: remove_anonymous_users node['mysql']['remove_anonymous_users']
29: remove_test_database node['mysql']['remove_test_database']
30: root_network_acl node['mysql']['root_network_acl']
31: version node['mysql']['version']
32: action :create
33: end
Compiled Resource:
------------------
# Declared in /var/chef/cache/cookbooks/mysql/recipes/server.rb:20:in `from_file'
mysql_service("default") do
action [:create]
retries 0
retry_delay 2
guard_interpreter :default
service_name "default"
version "5.5"
package_name "mysql55-server"
data_dir "/var/lib/mysql"
port "3306"
remove_anonymous_users true
remove_test_database true
server_root_password "iloverandompasswordsbutthiswilldo"
server_debian_password "iloverandompasswordsbutthiswilldo"
server_repl_password "iloverandompasswordsbutthiswilldo"
cookbook_name "mysql"
recipe_name "server"
end
Running handlers:
[2014-08-29T21:54:45+00:00] ERROR: Running exception handlers
Running handlers complete
[2014-08-29T21:54:45+00:00] ERROR: Exception handlers complete
[2014-08-29T21:54:45+00:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
Chef Client failed. 1 resources updated in 9.218038398 seconds
[2014-08-29T21:54:46+00:00] ERROR: mysql_service[default] (mysql::server line 20) had an error: ArgumentError: You must supply a name when declaring a package resource
[2014-08-29T21:54:47+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
答案 0 :(得分:1)
请参阅this
cookbook定义了它应该安装的软件包,在OS版本上有一个大的if / then选项。
我认为有一些与centos 7版本解析导致错误的东西。
也许您可以检查节点的platform_version
值,以找出无法确定正确包裹的原因。