0

I have created a template in chef, sending the value from attributes and recipes but getting error :

[2015-12-09T08:09:19-05:00] ERROR: Running exception handlers
[2015-12-09T08:09:19-05:00] ERROR: Exception handlers complete
[2015-12-09T08:09:19-05:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
[2015-12-09T08:09:19-05:00] INFO: Sending resource update report (run-id: a9175420-0358-4631-8d30-664fdfd792c0)
[2015-12-09T08:09:19-05:00] ERROR: undefined method `default' for Chef::Resource::Template
[2015-12-09T08:09:19-05:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)

How to resolve the error:

I have defined the attribute as :

default['abc']['LOG_FILE']=''

and in recipe it is

variables(


    :LOG_FILE => default['abc']['LOG_FILE'],
user3086014
  • 4,241
  • 5
  • 27
  • 56

1 Answers1

1

Your syntax is wrong, you need to use node instead of default when referencing attributes:

variables(


    :LOG_FILE => node['abc']['LOG_FILE'],
  • This is right but you will get a linting error for ruby 2.0 + The new syntax is: `LOG_FILE: node['abd']['LOG_FILE']` – Nick H. Dec 09 '15 at 22:00