【发布时间】:2016-04-27 18:42:56
【问题描述】:
我想使用应用程序的 environment_variables 设置一些属性,但我的实例在设置时一直失败,阅读文档 (http://docs.aws.amazon.com/opsworks/latest/userguide/workingcookbook-events.html) 我发现了这个:
"Setup includes Deploy; it runs the Deploy recipes after setup is complete.".
这是我的部署脚本的一部分
if node['deploy']['ws']['application'] && node['deploy']['ws']['environment_variables']['is_root_app'] == 'true'
web_app node['deploy']['ws']['application'] do
server_name node['fqdn']
server_aliases node['deploy']['ws']['domains']
template 'web_app.conf.erb'
docroot node.default['apache']['docroot_dir']
ssl_enabled node['deploy']['ws']['ssl_support']
enable true
end
end
这是安装日志
NoMethodError
-------------
undefined method `[]' for nil:NilClass
Cookbook Trace:
---------------
/var/chef/runs/254b8caa-cd70-4525-a2fd-71044afdf62d/local-mode-cache/cache/cookbooks/WebService/recipes/deploy_app.rb:8:in `from_file'
Relevant File Content:
----------------------
/var/chef/runs/254b8caa-cd70-4525-a2fd-71044afdf62d/local-mode-cache/cache/cookbooks/WebService/recipes/deploy_app.rb:
1: #
2: # Cookbook Name:: WebService
3: # Recipe:: default
4: #
5: # Copyright (c) 2016 The Authors, All Rights Reserved.
6:
7:
8>> if node['deploy']['ws']['application'] && node['deploy']['ws']['environment_variables']['is_root_app'] == 'true'
9: web_app node['deploy']['ws']['application'] do
10: server_name node['fqdn']
11: server_aliases node['deploy']['ws']['domains']
12: template 'web_app.conf.erb'
13: docroot node.default['apache']['docroot_dir']
14: ssl_enabled node['deploy']['ws']['ssl_support']
15: enable true
16: end
17: else
如果我还没有部署任何应用程序,安装后运行部署配方的目的是什么???如果不在 Deploy 配方中,可以在哪里使用 environment_variables ???
【问题讨论】:
标签: amazon-web-services chef-infra chef-recipe aws-opsworks