我已经成功地部署了我的应用程序使用AWS OpsWorks,现在我正在尝试实现自定义的厨师食谱,这将允许我设置bash环境变量。我已经安装了Git repo,Cookbook正在使用OpsWorks进行更新。我使用我的开发盒上的knife命令生成了食谱,它实际上只是包含几行代码的recipes/default.rb
文件的目录结构。Opsworks自定义厨师Recipies
当我尝试做一些像下面我似乎不断收到错误
node[:deploy].each do |application, deploy|
deploy = node[:deploy][application]
command "ls -la"
end
(注:LS -la是只是为了测试我知道这不会设置环境变量)
我得到以下错误:ERROR: Caught exception during execution of custom recipe: xyz-enviroment: NoMethodError - undefined method command' for #<Chef::Recipe:0x7feb59200c00> - /opt/aws/opsworks/releases/20130328224322_109/vendor/bundle/ruby/1.8/gems/chef-0.9.15.5/bin/../lib/chef/mixin/recipe_definition_dsl_core.rb:56:in method_missing
另外,如果我尝试像
execute "setting up the enviroment" do
# TODO: Add code that does something here
end
我得到以下错误:
execute[setting up the enviroment] (/opt/aws/opsworks/current/site-cookbooks/xyz-enviroment/recipes/default.rb:18:in `from_file') had an error:
No such file or directory - setting up the enviroment
我是新来的厨师,所以我敢肯定有一些简单的,我做错了我只是一直没能弄明白。先谢谢您的帮助。
这似乎工作。但是,我很想知道你最近是否找到了替代解决方案。有希望的是,无需重新启动Web服务器。 – 2014-01-28 19:07:19