Issue #22800 has been updated by David Portabella.
I have the same issue. according to http://docs.puppetlabs.com/guides/scope_and_puppet.html about dynamic lookup from an included puppet file: puppet 2.7 warns about it, and puppet 3.2 stops working, as expected. however, about dynamic lookup from a template called on an included puppet file: both puppet 2.7 and puppet 3.2 it works, without even a warning. (see in red the below example) Why is that? dynamic lookup in templates should show a warning in puppet 2.7, and stop working on puppet 3. See below a specific example: test.pp class c1 { $var = 'hello' notify {"var from c1: $var": } include c2 } class c2 { notify {"var from c2: $var": } file { '/tmp/file.txt': content => template('file.txt.erb'), } } class { c1: } file.txt.erb var from file.txt.erb: <%= @var %> ---- running with puppet 2.7.19: $ puppet apply --templatedir templates/ test.pp warning: Dynamic lookup of $var at /vagrant/t1/test.pp:8 is deprecated. For more information, see http://docs.puppetlabs.com/guides/scope_and_puppet.html. To see the change in behavior, use the --debug flag. notice: var from c1: hello notice: /Stage[main]/C1/Notify[var from c1: hello]/message: defined 'message' as 'var from c1: hello' notice: /Stage[main]/C2/File[/tmp/file.txt]/ensure: defined content as '{md5}ea0d73f3957b0893f63e03cb9d8c9d98' notice: var from c2: hello notice: /Stage[main]/C2/Notify[var from c2: hello]/message: defined 'message' as 'var from c2: hello' notice: Finished catalog run in 0.05 seconds $ cat /tmp/file.txt var from file.txt.erb: hello running with puppet 3.3.2: $ puppet apply --templatedir templates/ test.pp Notice: Compiled catalog for mac4c.local in environment production in 0.16 seconds Notice: var from c1: hello Notice: /Stage[main]/C1/Notify[var from c1: hello]/message: defined 'message' as 'var from c1: hello' Notice: var from c2: Notice: /Stage[main]/C2/Notify[var from c2: ]/message: defined 'message' as 'var from c2: ' Notice: /Stage[main]/C2/File[/tmp/file.txt]/ensure: defined content as '{md5}ea0d73f3957b0893f63e03cb9d8c9d98' $ cat /tmp/file.txt var from file.txt.erb: hello ---------------------------------------- Bug #22800: dynamic variable lookup works in templates https://projects.puppetlabs.com/issues/22800#change-100245 * Author: Robert Birnie * Status: Unreviewed * Priority: Normal * Assignee: * Category: templates * Target version: * Affected Puppet version: 3.2.2 * Keywords: templates scope * Branch: ---------------------------------------- Summary: >From within templates, dynamic lookup of variables seems to work. I can >declare a variable in the init.pp file. It shows up as undefined in the >configuration.pp file. But then it will work fine within the templates created >by configuration.pp. Steps to Reproduce: I've created a github repo with a simple module that shows off the issue. Basically its just creating a dynamic lookup variable in a template though, nothing special. https://github.com/rbirnie/puppet_scope_bug Expected Results: The variable should return undef which is what the manifests return. Actual Results: The variable returns the value that is assigned. Notes: Both agent and master are puppet 3.2.2 -- You have received this notification because you have either subscribed to it, or are involved in it. To change your notification preferences, please click here: http://projects.puppetlabs.com/my/account -- You received this message because you are subscribed to the Google Groups "Puppet Bugs" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/puppet-bugs. For more options, visit https://groups.google.com/groups/opt_out.
