Issue #5130 has been updated by Paul Nasrat. Status changed from Unreviewed to Accepted Target version set to 2.0.0
Yeah the lazy loading is confusing. Better ruby API is on the roadmap for 2.x ---------------------------------------- Bug #5130: Unable to reliably use Facter as a lib in ruby programs https://projects.puppetlabs.com/issues/5130 Author: Michael Stahnke Status: Accepted Priority: Normal Assignee: Category: Target version: 2.0.0 Keywords: Branch: When using facter as a ruby library, it behaves in somewhat unpredictable ways. We were trying to load some facts into an LDAP directory and ran into the issue of some facts being nil. I wrote up the simplest case I could think of below. I tried enabling debugging in facter and it wasn't of much use. (This is facter 1.5.8 from EPEL on RHEL 5.5 i386) A basic case here. <pre> require 'facter' shortname = Facter.value('hostname') puts shortname lsb = Facter.value('lsbdistdescription') puts lsb </pre> Output <pre>sbox03 nil</pre> In this case, the only thing I do is call the .to_hash method. Notice I don't even utilize the hash in the code in any other way. Obviously calling the .to_hash method does some thing that populates this lsb fact for the remainder of the program. Code <pre> require facter shortname = Facter.value('hostname') puts shortname hsh = Facter.to_hash lsb = Facter.value('lsbdistdescription') puts lsb </pre> Output <pre> sbox03 Red Hat Enterprise Linux Server release 5.5 (Tikanga) </pre> -- 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.
