Issue #7753 has been updated by Adrien Thebo.

I'm going to comment here, since the code is pretty old and needed to be 
rebased against 1.6.x.

Returning nil on the case of error while adding a result to a fact in fact.rb 
shouldn't be a problem; either the return value of Fact#add would return a 
Resolve object, or return nil. If the instance_eval didn't throw an exception 
and resolve was nil, then when @resolves was sorted, then an exception would be 
thrown since nil doesn't respond to #weight and nil would be returned anyways. 
I'm pretty (perhaps foolishly) comfortable with this behavior.

I'll go in and add some better testing around this though; it does need them.

The concern that I have with my patch is the options that should have been 
accepted by the resolve block obviously can't be added, so I effectively throw 
them away. Since adding the resolve failed the options probably aren't 
applicable anyways, but I don't entirely like this.

While I'm commenting, would it be worthwhile to do a Facter.warn so errors 
caught by this can be noticed?
----------------------------------------
Bug #7753: Errors when adding a resolve should not crash facter
https://projects.puppetlabs.com/issues/7753

Author: Adrien Thebo
Status: Tests Insufficient
Priority: Normal
Assignee: Adrien Thebo
Category: 
Target version: 
Keywords: 
Branch: https://github.com/adrienthebo/facter/tree/ticket%2Fmaster%2F7753
Affected Facter version: 


As evidenced by #7038, if an exception is thrown when adding a resolve to a 
fact, facter crashes. Instead of just failing, facter should catch any errors 
when adding a resolution to a fact and then discard the failed resolution.


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