11.6 template partials don't support node refs?


#1

When using the 11.6 chef-solo client on Solaris x86, it appears that partials
with node attribute references no longer work. The same templates and partials
worked fine when using 11.4.

Chef::Mixin::Template::TemplateError (Could not find a value for node. If you are explicitly setting variables in a template, include a node variable if you plan to use it.) on line #11:

9: The deployment “<%= @deployment_name %>” has been configured with
Solaris <%= node[‘platform_version’] %>
10:
11: <%= render “partial_linux_access.erb”, :variables => {
12: :hostname => @hostname,
13: :ipaddress => @ipaddress,

/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.6.0/lib/chef/mixin/template.rb:139:in
`rescue in _render_template’

When I replace the node attribute references with references to passed
variables, the partials work fine.

Has anyone encountered this issue?


#2

On Thursday, August 22, 2013 at 7:44 PM, cpkampmeier@gmail.com wrote:

When using the 11.6 chef-solo client on Solaris x86, it appears that partials
with node attribute references no longer work. The same templates and partials
worked fine when using 11.4.

Chef::Mixin::Template::TemplateError (Could not find a value for node. If you are explicitly setting variables in a template, include a node variable if you plan to use it.) on line #11:

9: The deployment “<%= @deployment_name %>” has been configured with
Solaris <%= node[‘platform_version’] %>
10:
11: <%= render “partial_linux_access.erb”, :variables => {
12: :hostname => @hostname,
13: :ipaddress => @ipaddress,

/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.6.0/lib/chef/mixin/template.rb:139:in
`rescue in _render_template’

When I replace the node attribute references with references to passed
variables, the partials work fine.

Has anyone encountered this issue?
Please file a bug report.

In any case, this error message occurs because the @node instance variable is nil. Adding :node => @node to the variables you pass in should work around it.


Daniel DeLeo