Issue #10505 has been updated by Michael Stahnke. Target version changed from 2.6.x to 2.7.x
2.6.x is closed. Moving to 2.7.x ---------------------------------------- Bug #10505: erb mangles if foo == "" and leaves variables undefined https://projects.puppetlabs.com/issues/10505 Author: Jos Boumans Status: Needs Decision Priority: High Assignee: Randall Hansen Category: templates Target version: 2.7.x Affected Puppet version: 2.6.3 Keywords: Branch: <pre> $ puppet --version 2.6.3 </pre> <pre> $ cat x.pp define bar ( $foo = "", $zot = "" ) { file { '/mnt/tmp/puppet.erb/out': content => template( '/mnt/tmp/puppet.erb/tmpl.erb' ), ensure => file, } } bar { $fqdn: foo => "42", zot => "43" } $ cat tmpl.erb foo 1: <%= foo %> zot 1: <%= zot %> <% if foo == "" %> <% foo = 1 %> <% end %> foo 2: <%= foo %> zot 2: <%= zot %> $ puppet x.pp notice: /Stage[main]//Bar[cc001.krxd.net]/File[/mnt/tmp/puppet.erb/out]/ensure: defined content as '{md5}c776b25cce50fdc968696030b77e9a4d' $ cat out foo 1: 42 zot 1: 43 foo 2: zot 2: 43 </pre> ################ Confirmed also in 2.7.x, the work around is: <% foo = scope.lookupvar('foo') || '1' %> -- 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 post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/puppet-bugs?hl=en.
