Issue #5510 has been updated by Michael Stahnke.

Basically, we have N files with facts in them (not just one fact per file).  
Some facts in file 03-whatever.rb depend on files in 01-whatever.rb.  
Initially, we thought facter was loading the facts in filename order, after 
testing on some different systems, it was clear that it was not, and was 
actually dependent on inode ordering. 

As for creating an API that you're afraid might break something in the future, 
I think that's how this needs to be.  If I can't rely on facter to use previous 
facts when making new ones, I would have to put all facts in one file and order 
them top down.  This is pain when we already have a few dozen facts and 
certainly will have more by the time we are complete with our implementation.  

For example, if I have facts doing some external lookup, I need to know the 
location of the URI to look something up, before I I try to grab a value form 
the URI.  

The other option would be to have some formal dependency ordering with facts.  
Filename ordering certainly isn't totally ideal, but also does not violate the 
principle of least surprise when working with custom facts. 



----------------------------------------
Bug #5510: facter custom fact ruby files should be loaded deterministically
https://projects.puppetlabs.com/issues/5510

Author: Rick Bradley
Status: Unreviewed
Priority: Normal
Assignee: 
Category: 
Target version: 
Keywords: 
Branch: 


When defining a set of custom facts via ruby libraries, the libraries are not 
loaded deterministically on different operating systems and/or filesystems.  
When a ruby-defined fact definition relies on the definition of other 
ruby-defined facts, the facts may not be evaluated depending upon the operating 
system / filesystem in use (e.g., Mac OSX by default appears to sort, while 
some variants of linux on ext3 appears to use another ordering).

The problem is that the return result from ruby's Dir.entries varies from 
platform to platform.

The obvious fix is to sort the return value from Dir.entries before use.

A pull request with specs for the problem and a resolution is forthcoming.



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