Issue #5820 has been updated by Jeff McCune.

Status changed from Accepted to Duplicate

# Action Required #

We have gone back and forth on this a lot.  At the very best we're wildly 
inconsistent in 3.x and all of our values for undef internally evaluate to 
truth and internally have non-empty to_s implementations.

Based on the huge number of undef related tickets in the issue tracker, I'm 
making a stand and saying #15329 is the real root cause of all of these issue.  
If you are a watcher on this ticket, please transfer your most pressing 
concerns to #15329.

Here is the list of related "undef" issues that I've found so far:

 * #4692
 * #5820
 * #6621
 * #6745
 * #8778
 * #8783
 * #13210
 * #14654
 * #14677
 * #14666

I am going to close this ticket as a duplicate of #15329.  Again, please 
transfer your most pressing concerns to #15329 in an effort to consolidate all 
of the issues related to undef variables in the Puppet DSL.

Thanks,
-Jeff
----------------------------------------
Bug #5820: Undefined variables throw poor error
https://projects.puppetlabs.com/issues/5820#change-66226

Author: James Turnbull
Status: Duplicate
Priority: Normal
Assignee: 
Category: error reporting
Target version: 
Affected Puppet version: 2.6.4
Keywords: 
Branch: 


In 0.25.5 and earlier undefined variables were accepted.  In 2.6.x and later 
they throw a poor error:

<pre>
node default { 
$my_array = [ $some_var, 'some value', ] 
file { "/tmp/test": 
content => inline_template("<%= my_array.reject(&:empty?).each do |val| val end 
-%>") 
} 
}
</pre>

If $some_var doesn't exist on 2.6.4.
then error is thrown:

Error 400 on SERVER: Failed to parse inline template: undefined method `empty?' 
for :undef:Symbol

Defining variable $some_var='' makes this work.  Error should indicate some_var 
is missing.




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