Issue #22121 has been updated by Yoann Le Touche.

Status changed from Unreviewed to Investigating
Assignee set to Yoann Le Touche
Keywords set to template, test, variable

----------------------------------------
Bug #22121: Documentation about testing for existence of variable in template 
is subtly wrong
https://projects.puppetlabs.com/issues/22121#change-98300

* Author: Thomas Vander Stichele
* Status: Investigating
* Priority: Normal
* Assignee: Yoann Le Touche
* Category: documentation
* Target version: 
* Affected Puppet version: 
* Keywords: template, test, variable
* Branch: 
----------------------------------------
http://docs.puppetlabs.com/guides/templating.html

If the variable is defined but false, if @variable is false just the same.

So using @ cannot be used purely to test definedness.

In my template, I worked around it like this:

<% if @require_valid_user == false -%>
require_valid_user = false
<% elsif @require_valid_user == true -%>
require_valid_user = true
<% else -%>
; require_valid_user = false
<% end -%>

I suggest updating the docs at least, or providing a real way to test for 
definedness-but-nothing-else.


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

Reply via email to