Hi, I''ve created this fact: require ''facter'' if FileTest.exists?("/etc/ha.d") if `service heartbeat status` =~ /running/ cib = `cibadmin -Q`.grep(/epoch/).to_s epoch = cib.scan(/[0-9]+/).first Facter.add("cib_epoch") do setcode do epoch.to_i + 1 end end end end end I''ve tested it as directed in the wiki: # facter cib_epoch 1 I''ve put it in /etc/puppet/facts, and run puppet on a cluster node. I get: # puppetd --test --debug info: Loading fact cib_epoch /usr/lib/ruby/site_ruby/1.8/puppet/network/client/master.rb:420:in `load'': /var/puppet/facts/cib_epoch.rb:17: syntax error (SyntaxError) from /usr/lib/ruby/site_ruby/1.8/puppet/network/client/master.rb:420:in `loaddir'' from /usr/lib/ruby/1.8/timeout.rb:56:in `timeout'' from /usr/lib/ruby/site_ruby/1.8/puppet/network/client/master.rb:419:in `loaddir'' from /usr/lib/ruby/site_ruby/1.8/puppet/network/client/master.rb:415:in `each'' from /usr/lib/ruby/site_ruby/1.8/puppet/network/client/master.rb:415:in `loaddir'' from /usr/lib/ruby/site_ruby/1.8/puppet/network/client/master.rb:431:in `loadfacts'' from /usr/lib/ruby/site_ruby/1.8/puppet/network/client/master.rb:430:in `each'' from /usr/lib/ruby/site_ruby/1.8/puppet/network/client/master.rb:430:in `loadfacts'' ... 7 levels... from /usr/lib/ruby/site_ruby/1.8/puppet/util/subclass_loader.rb:36:in `client'' from /usr/lib/ruby/site_ruby/1.8/puppet/util/subclass_loader.rb:67:in `send'' from /usr/lib/ruby/site_ruby/1.8/puppet/util/subclass_loader.rb:67:in `method_missing'' from /usr/sbin/puppetd:322 Any ideas what''s wrong? S. --~--~---------~--~----~------------~-------~--~----~ 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 10/14/2008 10:16 AM, Stephen Nelson-Smith wrote:> require ''facter'' > > if FileTest.exists?("/etc/ha.d") > if `service heartbeat status` =~ /running/ > cib = `cibadmin -Q`.grep(/epoch/).to_s > epoch = cib.scan(/[0-9]+/).first > Facter.add("cib_epoch") do > setcode do > epoch.to_i + 1 > end > end > end > end > end > > I''ve tested it as directed in the wiki: > > # facter cib_epoch > 1 > > I''ve put it in /etc/puppet/facts, and run puppet on a cluster node. > > I get: > > # puppetd --test --debug > info: Loading fact cib_epoch > /usr/lib/ruby/site_ruby/1.8/puppet/network/client/master.rb:420:in > `load'': /var/puppet/facts/cib_epoch.rb:17: syntax error (SyntaxError)> Any ideas what''s wrong?Extra ''end''? Not that I know Ruby at all well, but pasting the given code into Xemacs makes it complain about an invalid nest with the fifth ''end''. And if ''end'' is the complement to ''if'' and ''do'', then there should only be four. No idea why it works interactively, unless /var/puppet/facts/cib_epoch.rb is different than the cib_epoch that your facter run is using. -- Mike Renfro / R&D Engineer, Center for Manufacturing Research, 931 372-3601 / Tennessee Technological University --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Hi,> Extra ''end''? Not that I know Ruby at all well, but pasting the given > code into Xemacs makes it complain about an invalid nest with the fifth > ''end''. And if ''end'' is the complement to ''if'' and ''do'', then there > should only be four.There''s only four on the puppetmaster. Not quite sure how I managed to get five pasted into the email. But well spotted! S. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---