【问题标题】:chef cookbook for database creation getting error while knife ssh 'sudo chef-client'用于创建数据库的厨师食谱在刀 ssh 'sudo chef-client' 时出错
【发布时间】:2015-09-28 23:54:43
【问题描述】:

我对厨师很陌生!我正在关注 learn.chef.io 文档https://learn.chef.io/manage-a-web-app/ubuntu/apply-and-verify-your-database-configuration/ 来创建用于创建数据库的食谱!出现以下错误!所以请帮我弄清楚这里出了什么问题!

$ knife ssh 54.153.93.47 'sudo chef-client' --manual-list --ssh-user ubuntu --identity-file /home/ashish/Keys/chef1.pem

54.153.93.47 Starting Chef Client, version 12.4.2

54.153.93.47 resolving cookbooks for run list: ["awesome_customers"]

54.153.93.47 Synchronizing Cookbooks:

54.153.93.47 - yum-mysql-community

54.153.93.47 - firewall

54.153.93.47 - awesome_customers

54.153.93.47 - apt

54.153.93.47 - chef-sugar

54.153.93.47 - httpd

54.153.93.47 - poise

54.153.93.47 - build-essential

54.153.93.47 - mariadb

54.153.93.47 - database

54.153.93.47 - mysql

54.153.93.47 - mysql2_chef_gem

54.153.93.47 - openssl

54.153.93.47 - smf

54.153.93.47 - postgresql

54.153.93.47 - yum

54.153.93.47 - rbac

54.153.93.47 - yum-epel

54.153.93.47 Compiling Cookbooks...

54.153.93.47 [2015-09-28T13:18:36+00:00] WARN: You declared a new resource Chef::Provider::HttpdServiceRhelSysvinit for resource httpd_service, but it comes alphabetically after Chef::Provider::HttpdServiceRhelSystemd and has the same filters ({:platform_family=>["rhel", "fedora", "suse"]}), so it will not be used. Use override: true if you want to use it for httpd_service.

54.153.93.47 [2015-09-28T13:18:36+00:00] WARN: You are overriding httpd_service on {:platform_family=>["rhel", "fedora", "suse"]} with Chef::Provider::HttpdServiceRhelSystemd: used to be Chef::Provider::HttpdServiceRhelSysvinit. Use override: true if this is what you intended.

54.153.93.47 [2015-09-28T13:18:36+00:00] WARN: You declared a new resource Chef::Provider::HttpdServiceRhelSysvinit for resource httpd_service, but it comes alphabetically after Chef::Provider::HttpdServiceRhelSystemd and has the same filters ({:platform_family=>["rhel", "fedora", "suse"]}), so it will not be used. Use override: true if you want to use it for httpd_service.

54.153.93.47 [2015-09-28T13:18:36+00:00] WARN: You declared a new resource Chef::Provider::HttpdServiceRhelSysvinit for resource httpd_service, but it comes alphabetically after Chef::Provider::HttpdServiceRhelSystemd and has the same filters ({:platform_family=>["rhel", "fedora", "suse"]}), so it will not be used. Use override: true if you want to use it for httpd_service.

54.153.93.47

54.153.93.47 ================================================================================

54.153.93.47 Recipe Compile Error in /var/chef/cache/cookbooks/awesome_customers/recipes/default.rb

54.153.93.47 ================================================================================

54.153.93.47

54.153.93.47 NameError

54.153.93.47 ---------

54.153.93.47 No resource, method, or local variable named `chef' for `Chef::Recipe "database"'

54.153.93.47

54.153.93.47 Cookbook Trace:

54.153.93.47 ---------------

54.153.93.47 /var/chef/cache/cookbooks/awesome_customers/recipes/database.rb:15:in `from_file'

54.153.93.47 /var/chef/cache/cookbooks/awesome_customers/recipes/default.rb:11:in `from_file'

54.153.93.47

54.153.93.47 Relevant File Content:

54.153.93.47 ----------------------

54.153.93.47 /var/chef/cache/cookbooks/awesome_customers/recipes/database.rb:

54.153.93.47

54.153.93.47 8: action :install

54.153.93.47 9: end

54.153.93.47 10:

54.153.93.47 11: mysql_client 'default' do

54.153.93.47 12: action :create

54.153.93.47 13: end

54.153.93.47 14:

54.153.93.47 15>> password_secret = chef::EncryptedDataBagItem.load_secret(node['awesome_customers']['passwords']['secret_path'])

54.153.93.47 16: root_password_data_bag_item = Chef::EncryptedDataBagItem.load('passwords', 'sql_server_root_password', password_secret)

54.153.93.47 17:

54.153.93.47 18: mysql_service 'default' do

54.153.93.47 19: initial_root_password root_password_data_bag_item['password']

54.153.93.47 20: action [:create, :start]

54.153.93.47 21: end

54.153.93.47 22:

54.153.93.47 23: # Create the database instance.

54.153.93.47 24: #mysql_database 'products' do

54.153.93.47

54.153.93.47

54.153.93.47 Running handlers:

54.153.93.47 [2015-09-28T13:18:36+00:00] ERROR: Running exception handlers

54.153.93.47 Running handlers complete

54.153.93.47 [2015-09-28T13:18:36+00:00] ERROR: Exception handlers complete

54.153.93.47 Chef Client failed. 0 resources updated in 2.549055767 seconds

54.153.93.47 [2015-09-28T13:18:37+00:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out

54.153.93.47 [2015-09-28T13:18:37+00:00] ERROR: No resource, method, or local variable named `chef' for `Chef::Recipe "database"'

54.153.93.47 [2015-09-28T13:18:37+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)

因为我是新手,所以我找不到错误!请帮我找出问题所在!

ps:我有 ec2 实例作为厨师节点和开源托管厨师服务器。 自从上次成功创建以前的用于 Web 服务器创建的说明书以来,我已经停止并重新启动了实例!

【问题讨论】:

    标签: database ssh chef-infra chef-recipe cookbook


    【解决方案1】:

    阅读您的日志,厨师很友善地标记了有问题的行(重点是我的):

    54.153.93.47 名称错误

    54.153.93.47 ---------

    54.153.93.47 `Chef::Recipe "database"' 没有名为 `chef' 的资源、方法或局部变量

    [ .... ] 剥去一部分以缩短

    54.153.93.47 14:

    54.153.93.47 15**>>** password_secret = chef::EncryptedDataBagItem.load_secret(node['awesome_customers']['passwords']['secret_path'])

    54.153.93.47 16: root_password_data_bag_item = Chef::EncryptedDataBagItem.load('passwords', 'sql_server_root_password', password_secret)

    54.153.93.47 17:

    您的password_secret 行中的Chef:: 只是小写c 的错字

    【讨论】:

    • 我尝试了大写的“Chef”和小写的“chef”,但得到了同样的错误!修改后的 bty 我跑了: $ berks install Resolving cookbook dependencies... 从源代码获取“awesome_customers”。使用 apt (2.6.1)Using awesome_customers (0.2.0) 来自 .使用 poise (2.3.2) 使用 postgresql (3.4.16) 使用 rbac (1.0.3) 使用 smf (2.2.7) 使用 yum (3.7.1) 使用 yum-epel (0.6.3) 使用 yum-mysql-community (0.1.18)
    • $ berks upload awesome_customers 跳过 awesome_customers (0.2.0) (冻结) $knife ssh 54.153.93.47 'sudo chef-client' --manual-list --ssh-user ubuntu --identity-file /home/ashish/Keys/chef1.pem
    • 确实,一旦修改,您必须在 chef-server 上上传新版本....这意味着您必须在 metadata.rb 中修改版本或强制上传
    猜你喜欢
    • 1970-01-01
    • 2015-12-13
    • 2012-07-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多