我正在尝试使用我从AWS获得的opsworks配方来部署我的rails应用程序。我试图通过引用博客here来设置整个事情。无论他说什么都是" php"或者" php-app",我用" rails"和我的应用名称。
我对该应用程序的角色JSON看起来像这样 -
{
"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"
}
当我尝试部署时,它会很好地运行其他配方,并因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:
如果我打开opsworks_deploy' for
,该功能就在那里 -
block in from_file'
==> app: /tmp/vagrant-chef-3/chef-solo-1/cookbooks/deploy/recipes/rails.rb:2:in
我在这里错过了一些非常愚蠢的东西吗?
答案 0 :(得分:1)
行。花了2天后,在google搜索结果的某个角落,我发现了这个 - https://tickets.opscode.com/browse/CHEF-5011
在下面粘贴一些相关信息 -
对Recipe DSL的更改会导致在Resource的do..end块内发生的任何NoMethodError或NameError被错误地报告为类似的内容 没有名为
file' for
Chef :: Recipe“default”'的资源或方法 例如,以下配方代码中的错误显然是文件资源中的no_method_here
位:
file "/tmp/whatever" do no_method_here end
但是,错误报告为:
=============================================== =================================
=============================================== =================================
NoMethodError
没有名为
的资源或方法file' for
Chef :: Recipe“default”'食谱追踪:
/private/tmp/error_message_repro/repro/recipes/default.rb:1:in
from_file'`相关文件内容:
/private/tmp/error_message_repro/repro/recipes/default.rb:
1>> file "/tmp/whatever" do 2: no_method_here 3: end 4:
有人放入补丁和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
(假设您的厨师客户在/ opt / chef)
希望这有助于某些人经历同样的痛苦。