title: hiera dealing with undefined variables in erb templates
body: <p>I start using hiera for environment  or machine specific variables but I am facing an issue when variable is not found nowhere. Desired behaviour is that shouldn't be included into template. 
  I did following:
  In my manifest code</p>
  
  <pre><code>$yarn_app_mapreduce_am_command_opts=hiera('yarn.app.mapreduce.am.command-opts',undef) 
  </code></pre>
  
  <p>and in erb template I have:</p>
  
  <pre><code>&lt;% if !@yarn_app_mapreduce_am_command_opts.nil? %&gt;   
      &lt;property&gt;
      &lt;name&gt;yarn.app.mapreduce.am.command-opts&lt;/name&gt;
      &lt;value&gt;&lt;%= @yarn_app_mapreduce_am_command_opts %&gt;&lt;/value&gt;
    &lt;/property&gt;
  &lt;%end %&gt;
  </code></pre>
  
  <p>According to the documentation <a href="https://docs.puppetlabs.com/guides/templating.html#testing-for-undefined-variables" rel="nofollow">here</a> safest is to test on nil. I tried several variants but non of them worked.</p>
  
  <p>Could someone help?</p>