尝试在Opsworks设置上执行配方。所有的应用程序都是Wordpress网站,他们部署得很好但是当我尝试通过厨师执行食谱时,我会得到以下错误日志。
我刚从头创建了这个应用程序,所以它是全新的。我相信如果我在另一个堆栈上创建它可能会正常工作。难道我可能没有正确设置数据库或类似的东西吗?
这个错误有时是经常发生的,我相信它可能与以前的Opsworks应用程序没有正确部署有关,因为日志不能为我提供很多信息而坚持如何解决这个问题。
================================================================================
Recipe Compile Error in /var/lib/aws/opsworks/cache.stage2/cookbooks/wordpress/recipes/configure.rb
================================================================================
NoMethodError
-------------
undefined method `[]' for nil:NilClass
Cookbook Trace:
---------------
/var/lib/aws/opsworks/cache.stage2/cookbooks/wordpress/recipes/configure.rb:50:in `block in from_file'
/var/lib/aws/opsworks/cache.stage2/cookbooks/wordpress/recipes/configure.rb:26:in `each'
/var/lib/aws/opsworks/cache.stage2/cookbooks/wordpress/recipes/configure.rb:26:in `from_file'
Relevant File Content:
----------------------
/var/lib/aws/opsworks/cache.stage2/cookbooks/wordpress/recipes/configure.rb:
43: :host => (deploy[:database][:host] rescue nil),
44: :keys => (keys rescue nil)
45: )
46: end
47:
48:
49: # Import Wordpress database backup from file if it exists
50>> mysql_command = "/usr/bin/mysql -h #{deploy[:database][:host]} -u #{deploy[:database][:username]} #{node[:mysql][:server_root_password].blank? ? '' : "-p#{node[:mysql][:server_root_password]}"} #{deploy[:database][:database]}"
51:
52: Chef::Log.debug("Importing Wordpress database backup...")
53: script "memory_swap" do
54: interpreter "bash"
55: user "root"
56: cwd "#{deploy[:deploy_to]}/current/"
57: code <<-EOH
58: if ls #{deploy[:deploy_to]}/current/*.sql &> /dev/null; then
59: #{mysql_command} < #{deploy[:deploy_to]}/current/*.sql;
[2016-09-21T23:42:52+00:00] ERROR: Running exception handlers
[2016-09-21T23:42:52+00:00] ERROR: Exception handlers complete
[2016-09-21T23:42:52+00:00] FATAL: Stacktrace dumped to /var/lib/aws/opsworks/cache.stage2/chef-stacktrace.out
[2016-09-21T23:42:52+00:00] ERROR: undefined method `[]' for nil:NilClass
[2016-09-21T23:42:52+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)