Issue #14666 has been updated by eric sorenson.

FWIW this behaves as expected on 3.x:

<pre>
[[email protected] ~/Sandbox/puppet-undef/manifests]% cat 
14666-undefined-string.pp 
file{ "/tmp/undefined_issue.poc":
    ensure  => present,
    content =>inline_template('the answer is: <%= 
scope.lookupvar("mysql_server_id") %>') 
}
[[email protected] ~/Sandbox/puppet-undef/manifests]% more 
/tmp/undefined_issue.poc 
the answer is: 
</pre>
----------------------------------------
Bug #14666: puppet puts 'undefined' string in place of empty variables used in 
templates.
https://projects.puppetlabs.com/issues/14666#change-69624

Author: Dominik Zyla
Status: Duplicate
Priority: Normal
Assignee: 
Category: templates
Target version: 
Affected Puppet version: 2.7.14
Keywords: templates undefined empty variable empty string
Branch: 


As in topic. Here is POC:

<pre>
[11:10] admin0:~/puppet/devel # cat poc.pp                    
file{"/tmp/undefined_issue.poc":
  ensure  => present,
  content =>inline_template('<% if scope.lookupvar("mysql_server_id") != "" 
%>server-id  = <%= scope.lookupvar("mysql_server_id") %><% end %>') 
}
[11:10] admin0:~/puppet/devel # puppet apply poc.pp           
notice: /Stage[main]//File[/tmp/undefined_issue.poc]/ensure: created
notice: Finished catalog run in 0.40 seconds
[11:10] admin0:~/puppet/devel # cat /tmp/undefined_issue.poc  
server-id  = undefined#             

[11:10] admin0:~/puppet/devel # 
</pre>

I think empty string should be returned or an exception raised.



-- 
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.

Reply via email to