2015-09-28 118 views
0

我對廚師很新!我正在學習learn.chef.io文件https://learn.chef.io/manage-a-web-app/ubuntu/apply-and-verify-your-database-configuration/來創建數據庫創建的食譜!獲取以下錯誤!所以請幫我弄清楚這裏有什麼問題!廚師食譜數據庫創建獲取錯誤,而刀ssh'sudo廚師客戶'

$ 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) 

因爲我是新手,所以我無法找到錯誤! plz幫我找出有什麼問題!

ps:我有ec2實例作爲廚師節點&開源託管的廚師服務器。 我已經停止&自上次成功創建Web服務器創建以前的食譜以來重新啓動實例!

回答

1

閱讀你的日誌,廚師還跟標記問題的行(重點是我的):

54.153.93.47 NameError

54.153.93.47 ---------

54.153.93.47沒有資源,方法,或命名爲'ç HEF '的'廚師::配方 「數據庫」'

[...] Strippe局部變量達部分縮短

54.153.93.47 14:

54.153.93.47 15 ** ** >> = password_secretÇHEF :: EncryptedDataBagItem.load_secret(節點[ 'awesome_customers'] [ '密碼' ] [ 'secret_path'])

54.153.93.47 16:root_password_data_bag_item = ç HEF :: EncryptedDataBagItem.load( '密碼', 'sql_server_root_password',password_secret)

54.153.93.47 17:

你只是有一個小寫cChef::一個錯字在你password_secret

+0

我試着用兩上「廚師」和小寫的「大廚」,但得到了同樣的錯誤! bty在修改後我跑了:$ berks install 解決食譜依賴關係... 從源碼獲取'awesome_customers'。 使用apt(2.6.1)使用來自at at的awesome_customers(0.2.0)。 使用泊(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) –

+0

$ berks上傳awesome_customers 跳過awesome_customers(0.2.0)(frozen) $ knife ssh 54.153.93.47'sudo chef-client'--manual-list --ssh -user ubuntu --identity-file /home/ashish/Keys/chef1.pem –

+0

事實上,一旦修改,你必須在廚師服務器上上傳新版本....這意味着你必須在metadata.rb或強制上傳 – Tensibai