|
I've been hit by this. ifconfig takes 0.159 seconds to run and facter as a whole takes ~30s on my test node.
Adapting this idiom will make the above patch much cleaner:
-
From http://stackoverflow.com/questions/3602518/how-do-i-cache-a-method-with-ruby-rails
def get_listings @listings ||= get_listings! end
def get_listings! Hpricot.XML(open(xml_feed)) end
—
https://github.com/puppetlabs/facter/blob/master/lib/facter/util/ip.rb#L81
For reference, the 'ip addr' command takes 0.009s to run on this same node.
Using 'ip addr' or caching the output of 'ifconfig -a' will make facter run in a small fraction of the time with negligible overhead.
I'm currently using facter 2.4.1 from a gem.
|