Hi!
I have a template that contains a reference to node (node[‘fqdn’], to be
exact). It works on chef 10 and 11.6, but chokes on chef 11.8 with:
================================================================================
Error executing action install
on resource ‘sudo[converter]’
NameError
undefined local variable or method `node’ for
#Erubis::Context:0x000000051f66e8
This doesn’t specify the template or the issue. Any-hoo, I was able to
track it down, I think to the template above which contains:
This file is managed by Chef for <%= node[‘fqdn’] %>
Do NOT modify this file directly.
<% @commands.each do |command| -%>
<%= @sudoer %> <%= @host %>=(<%= @runas %>) <%= ‘NOPASSWD:’ if @nopasswd
%><%= command %>
<% end -%>
It works when I change that first line to:
This file is managed by Chef for <%= *@*node[‘fqdn’] %>
Did something change in chef? I’m looked around the tubes for beaking
changes and don’t see this as one . . . anyone have any advice!?
Thanks a lot,
Guy
On Tuesday, March 11, 2014 at 6:56 AM, Guy Matz wrote:
Hi!
I have a template that contains a reference to node (node['fqdn'], to be exact). It works on chef 10 and 11.6, but chokes on chef 11.8 with:
================================================================================
Error executing action install
on resource 'sudo[converter]'
NameError
undefined local variable or method `node' for #Erubis::Context:0x000000051f66e8
This doesn't specify the template or the issue. Any-hoo, I was able to track it down, I think to the template above which contains:
This file is managed by Chef for <%= node['fqdn'] %>
Do NOT modify this file directly.
<% @commands.each do |command| -%>
<%= @sudoer %> <%= @host %>=(<%= @runas %>) <%= 'NOPASSWD:' if @nopasswd %><%= command %>
<% end -%>
It works when I change that first line to:
This file is managed by Chef for <%= @node['fqdn'] %>
Did something change in chef? I'm looked around the tubes for beaking changes and don't see this as one . . . anyone have any advice!?
Thanks a lot,
Guy
Your error message makes it look like this cookbook is doing some template operations outside of the chef template resource, is that true (maybe to pass something to sudo to verify before writing)? Otherwise I would expect the error message to mention Chef::Mixin::Template::TemplateContext.
Is this from a community cookbook? You might want to file an issue with the maintainer in that case.
--
Daniel DeLeo