On Sunday, June 16, 2013 at 9:22 PM, Yonah Russ wrote:
Hi,I'm having similar issues in another context.I have a role defined (approximately) as follows:{"name":"ed-mobile","chef_type":"role","json_class": "Chef::Role","default_attributes": {"webconfig":{"server_path":"/opt/local/www/","newrelic": {"key" : "xxxxxxxxxxxxxxxxxxxxxxxxxxxx","appname" : "WWW"}}},"description": "Static Mobile Sites or Applications","run_list": [....]}In my default recipe I have this resource:template "/opt/local/etc/nrsysmond.cfg" dosource "nrsysmond.cfg.erb"owner "root"group "root"mode "0644"notifies :restart, resources(:service => "nrsysmond")endThe template tries to use the role attribute as follows:license_key=<%= node['webconfig']['newrelic']['key'] %>I get the following error:on line #1614: # Default: none15: #16: license_key=<%= node['webconfig']['newrelic']['key'] %>17:18: #[2013-06-16T16:02:00+00:00] ERROR: Running exception handlers[2013-06-16T16:02:00+00:00] ERROR: Exception handlers complete[2013-06-16T16:02:00+00:00] FATAL: Stacktrace dumped to /etc/chef/chef-solo/chef-stacktrace.out[2013-06-16T16:02:00+00:00] FATAL: Chef::Mixin::Template::TemplateError: undefined method `[]' for nil:NilClassIf I move"webconfig":{"newrelic": {"key" : "xxxxxxxxxxxxxxxxxxxxxxxxxxxx","appname" : "WWW"}},into my json attributes file instead, everything works perfectly.Any ideas?Yonah
Archive powered by MHonArc 2.6.16.