[Puppet - Bug #22800] dynamic variable lookup works in templates
Issue #22800 has been updated by David Portabella. Felix Frank wrote: > David Portabella wrote: > > > > the deprecated version does not work 100% as intended. > > in my opinion, to work 100% as intended, the templates should show a > > warning against using dynamic lookup (as it is done in puppet manifests). > > Does attempting the use of dynamically scoped variables still lead to > warnings? I was under the impression that since 3.0 it just won't work. i was talking about puppet 2.7: puppet 2.7 does not work 100% as intended. in my opinion, for puppet 2.7 to work 100% as intended, the templates should show a warning against using dynamic lookup (as it is done in puppet manifests). > I don't think such a warning can be reliably generated, for the same reason > that dynamic scoping did not work predictably (which is why it was finally > removed). So I'm fine with the lack of a warning either way. puppet 2.7 already shows a warning about using dynamic lookup on manifest programs (.pp). it makes sense to have the same behaviour for templates. Bug #22800: dynamic variable lookup works in templates https://projects.puppetlabs.com/issues/22800#change-100278 * Author: Robert Birnie * Status: In Topic Branch Pending Review * Priority: Normal * Assignee: Damon Atkins * Category: templates * Target version: * Affected Puppet version: 3.2.2 * Keywords: templates scope * Branch: https://github.com/puppetlabs/puppet/pull/2117 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 puppet-bugs+unsubscr...@googlegroups.com. To post to this group, send email to puppet-bugs@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-bugs. For more options, visit https://groups.google.com/groups/opt_out.
[Puppet - Bug #22800] dynamic variable lookup works in templates
Issue #22800 has been updated by Felix Frank. David Portabella wrote: > > the deprecated version does not work 100% as intended. > in my opinion, to work 100% as intended, the templates should show a warning > against using dynamic lookup (as it is done in puppet manifests). Does attempting the use of dynamically scoped variables still lead to warnings? I was under the impression that since 3.0 it just won't work. I don't think such a warning can be reliably generated, for the same reason that dynamic scoping did not work predictably (which is why it was finally removed). So I'm fine with the lack of a warning either way. Bug #22800: dynamic variable lookup works in templates https://projects.puppetlabs.com/issues/22800#change-100277 * Author: Robert Birnie * Status: In Topic Branch Pending Review * Priority: Normal * Assignee: Damon Atkins * Category: templates * Target version: * Affected Puppet version: 3.2.2 * Keywords: templates scope * Branch: https://github.com/puppetlabs/puppet/pull/2117 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 puppet-bugs+unsubscr...@googlegroups.com. To post to this group, send email to puppet-bugs@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-bugs. For more options, visit https://groups.google.com/groups/opt_out.
[Puppet - Bug #22800] dynamic variable lookup works in templates
Issue #22800 has been updated by David Portabella. Felix Frank wrote: > Turns out this only happens with the new @var syntax in templates. > > The (now deprecated) <%= var %> still works as intended. the deprecated version does not work 100% as intended. in my opinion, to work 100% as intended, the templates should show a warning against using dynamic lookup (as it is done in puppet manifests). Bug #22800: dynamic variable lookup works in templates https://projects.puppetlabs.com/issues/22800#change-100273 * Author: Robert Birnie * Status: Accepted * Priority: Normal * Assignee: Robert Birnie * 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 puppet-bugs+unsubscr...@googlegroups.com. To post to this group, send email to puppet-bugs@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-bugs. For more options, visit https://groups.google.com/groups/opt_out.
[Puppet - Bug #22800] dynamic variable lookup works in templates
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 puppet-bugs+unsubscr...@googlegroups.com. To post to this group, send email to puppet-bugs@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-bugs. For more options, visit https://groups.google.com/groups/opt_out.