Hi all. I''ve got this fact, trying to use it with the munin module from DavidS to work out which drives to graph. Fairly run of the mill, but when ever I add this in to my facter folder. Puppet barfs with a Timeout::Error [root@foo-vm:~]# invoke-rc.d puppet start Starting puppet configuration management tool info: Loading fact whatraid info: Loading fact localdisks /usr/lib/ruby/1.8/timeout.rb:60: execution expired (Timeout::Error) from /var/lib/puppet/lib/facter/localdisks.rb:20:in `open'' from /var/lib/puppet/lib/facter/localdisks.rb:20 from /usr/lib/ruby/1.8/facter/util/fact.rb:38:in `instance_eval'' from /usr/lib/ruby/1.8/facter/util/fact.rb:38:in `add'' The fact (yeah it''s ugly...): Facter.add("localdisks") do disks = [ ] File.open( "/proc/mounts" , "r" ) do |f| f.each do |line| foo = line.chomp!.split("\s") matchey = foo[0].match(/^\/dev\/([a-z0-9\/]+)[0-9]/) disks.push(matchey[1]) unless matchey.nil? end end setcode do disks.uniq.join('','') end end However, from the command line with facter, it works: [root@foo-vm:~]# FACTERLIB=/var/lib/puppet/lib/facter/ facter localdisks sda So I''m a little confused. What have I done painfully wrong? ): -- Ben Hughes - MindCandy -- Mind Candy Ltd, Registered in England: 05119483, Registered office: 41 Welbeck Street, London, W1G 8EA, UK --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en -~----------~----~----~----~------~----~------~--~---
On Feb 4, 2009, at 8:26 AM, Ben Hughes wrote:> > Hi all. > > I''ve got this fact, trying to use it with the munin module from DavidS > to work out which drives to graph. Fairly run of the mill, but when > ever > I add this in to my facter folder. Puppet barfs with a Timeout::Error > > [root@foo-vm:~]# invoke-rc.d puppet start > Starting puppet configuration management tool > info: Loading fact whatraid > info: Loading fact localdisks > /usr/lib/ruby/1.8/timeout.rb:60: execution expired (Timeout::Error) > from /var/lib/puppet/lib/facter/localdisks.rb:20:in `open'' > from /var/lib/puppet/lib/facter/localdisks.rb:20 > from /usr/lib/ruby/1.8/facter/util/fact.rb:38:in `instance_eval'' > from /usr/lib/ruby/1.8/facter/util/fact.rb:38:in `add'' > > > The fact (yeah it''s ugly...): > > Facter.add("localdisks") do > > disks = [ ] > File.open( "/proc/mounts" , "r" ) do |f| > f.each do |line| > foo = line.chomp!.split("\s") > matchey = foo[0].match(/^\/dev\/([a-z0-9\/]+)[0-9]/) > disks.push(matchey[1]) unless matchey.nil? > end > end > > setcode do > disks.uniq.join('','') > end > end > > However, from the command line with facter, it works: > [root@foo-vm:~]# FACTERLIB=/var/lib/puppet/lib/facter/ facter > localdisks > sda > > > So I''m a little confused. What have I done painfully wrong? ):Maybe something about a difference in environment making /proc/mounts not work? The code certainly looks right to me, although I''ll note that your fact value won''t update in the same process -- I''d put all of that code inside the setcode block. -- Love is a snowmobile racing across the tundra and then suddenly it flips over, pinning you underneath. At night, the ice weasels come. --Matt Groening --------------------------------------------------------------------- Luke Kanies | http://reductivelabs.com | http://madstop.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en -~----------~----~----~----~------~----~------~--~---
Ben Hughes wrote:> I''ve got this fact, trying to use it with the munin module from DavidS > to work out which drives to graph. Fairly run of the mill, but when ever > I add this in to my facter folder. Puppet barfs with a Timeout::Error > > [root@foo-vm:~]# invoke-rc.d puppet start > Starting puppet configuration management tool > info: Loading fact whatraid > info: Loading fact localdisks > /usr/lib/ruby/1.8/timeout.rb:60: execution expired (Timeout::Error) > from /var/lib/puppet/lib/facter/localdisks.rb:20:in `open'' > from /var/lib/puppet/lib/facter/localdisks.rb:20 > from /usr/lib/ruby/1.8/facter/util/fact.rb:38:in `instance_eval'' > from /usr/lib/ruby/1.8/facter/util/fact.rb:38:in `add'' > > > The fact (yeah it''s ugly...): > > Facter.add("localdisks") do > > disks = [ ] > File.open( "/proc/mounts" , "r" ) do |f| > f.each do |line| > foo = line.chomp!.split("\s") > matchey = foo[0].match(/^\/dev\/([a-z0-9\/]+)[0-9]/) > disks.push(matchey[1]) unless matchey.nil? > end > end > > setcode do > disks.uniq.join('','') > end > endSeeing /proc/mounts jumps out at me. I have a simple fact that I added as a plugin and causes a similar timeout. In my case, the code which reads /proc/mounts is in read_mounts in puppet/util/selinux.rb. So whenever I have selinux enabled (on a system with libselinux-ruby), I get this timeout and the plugin retrieval fails. It''s quite strange, as /proc/mounts is successfully read many times during the course of a puppetd run, both before and after the plugin syncing. Yet it always fails at this same point. For anyone curious, this was already filed as: http://projects.reductivelabs.com/issues/1963 -- Todd OpenPGP -> KeyID: 0xBEAF0CE3 | URL: www.pobox.com/~tmz/pgp ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The greatest gift you can give another is the purity of your attention. -- Richard Moss, M.D.