22
What is the proper way to check if a variable is undef in a puppet template?
In the manifest the variable is defined as follows
$myvar = undef
How is this checked in the template?
Is saw the following two variants
<% if @myvar -%>
<% end -%>
and
<% if not @myvar.nil? and @myvar -%>
<% end -%>
They both seem to work in my case, but I wonder if the first approach fails in on certain cases?