我在chef中创建了一个模板,从属性和配方中发送值,但收到错误:
[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)
如何解决错误:
我已将该属性定义为:
默认[ 'ABC'] [ 'LOG_FILE'] = ''
在食谱中它是
variables(
:LOG_FILE => default['abc']['LOG_FILE'],
答案 0 :(得分:1)
您的语法错误,在引用属性时需要使用node而不是default:
variables(
:LOG_FILE => node['abc']['LOG_FILE'],