On Oct 7, 2008, at 2:35 PM, Martin Englund wrote: > Gang, > > how do I force facter to calculate a fact value each time it asked for > instead of at startup? (see facter feature #1424 for the details)
Basically, you just need to have the calculation portion of the code done inside the block used for Fact creation. I can't get access to the code because github is too damned slow, but basically, you want to create a chunk of code (module or class) that knows how to collect the appropriate information, and then call some method on that class or whatever within your fact. E.g., here's an example of how to do it: # in lib/facter/mystuff.rb module Facter::Mystuff def self.discover_value(name) ...some code... end end Facter.add(:mystuff) do setcode { Facter::Mystuff.discover_value(:mystuff) } end You don't want to ever just set a value: value = Facter::Mystuff.discover_value(:mystuff) Facter.add(:mystuff) do setcode value # This is wrong end Make sense? -- I used to get high on life but lately I've built up a resistance. --------------------------------------------------------------------- Luke Kanies | http://reductivelabs.com | http://madstop.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Puppet Developers" group. To post to this group, send email to puppet-dev@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/puppet-dev?hl=en -~----------~----~----~----~------~----~------~--~---