Reputation: 8118
I am trying to deploy my rails app with opsworks recipes that I get from AWS. I tried to setup the entire thing by referring a blog here. Whatever he says is "php" or "php-app", I replaced with "rails" and my app name.
My role JSON for the app looks like this -
{
"name": "hercules",
"description": "OpsWorks recipe run-list for the rails app layer",
"app_type": "rails",
"default_attributes": {
"max_pool_size": 5
},
"run_list": [
"recipe[opsworks_initial_setup]",
"recipe[dependencies]",
"recipe[unicorn::rails]",
"recipe[rails::configure]",
"recipe[deploy::default]",
"recipe[deploy::rails]"
],
"chef_type": "role",
"json_class": "Chef::Role"
}
When I try to deploy, it runs other recipes well and gets stuck on this error for deploy::rails
-
==> app: ================================================================================
==> app: Recipe Compile Error in /tmp/vagrant-chef-3/chef-solo-1/cookbooks/deploy/recipes/rails.rb
==> app: ================================================================================
==> app:
==> app:
==> app: NoMethodError
==> app: -------------
==> app: No resource or method named
opsworks_deploy' for
Chef::Recipe "rails"'
==> app:
==> app:
==> app: Cookbook Trace:
==> app: ---------------
==> app: /tmp/vagrant-chef-3/chef-solo-1/cookbooks/deploy/recipes/rails.rb:20:in block in from_file'
==> app: /tmp/vagrant-chef-3/chef-solo-1/cookbooks/deploy/recipes/rails.rb:2:in
each'
==> app: /tmp/vagrant-chef-3/chef-solo-1/cookbooks/deploy/recipes/rails.rb:2:in `from_file'
==> app:
If I open the rails.rb:20
, that function is there -
opsworks_deploy do
Chef::Log.info("****** hi there *")
Chef::Log.info("#{application}")
Chef::Log.info(deploy.inspect)
app application
deploy_data deploy
end
Am I missing something terribly stupid here?
Upvotes: 1
Views: 887
Reputation: 8118
OK. After spending 2 days behind this, in some far corner of google's search results, I found this - https://tickets.opscode.com/browse/CHEF-5011
Pasting some relevant info below -
A change to the Recipe DSL causes any NoMethodError or NameError that occurs inside a Resource's do..end block to be incorrectly reported as something like
No resource or method namedfile' for
Chef::Recipe "default"' For example, the error in the following recipe code is clearly theno_method_here
bit inside the file resource:
file "/tmp/whatever" do no_method_here end
However, the error gets reported as:
================================================================================
Recipe Compile Error in /private/tmp/error_message_repro/repro/recipes/default.rb
================================================================================
NoMethodError
No resource or method named
file' for
Chef::Recipe "default"'Cookbook Trace:
/private/tmp/error_message_repro/repro/recipes/default.rb:1:in
from_file'`Relevant File Content:
/private/tmp/error_message_repro/repro/recipes/default.rb:
1>> file "/tmp/whatever" do 2: no_method_here 3: end 4:
And someone puts in a patch and a oneliner -
sudo wget https://github.com/opscode/chef/raw/29e732d97ec7e28b2111aca9f93edfd1bc257c2d/lib/chef/dsl/recipe.rb -O /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.10.0/lib/chef/dsl/recipe.rb --no-check-certificate
(assumes your chef client is in /opt/chef)
Hope this helps someone going through same pain.
Upvotes: 1