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 [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-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to