On Jun 29, 2011, at 1:16 AM, brijesh wrote:
> Hi
>
> I have been having issue with deploying my custom facts. I have gone
> through wiki on puppet labs and few other blogs but has no luck so
> far. May be i am not understanding puppet very well. I would really
> appreciate if someone helps me with this. I have the following fact i
> want to deploy.
>
> Facter.add("curtime") do
> setcode do
> %x{ foo=`date +%k` ; if [ "$foo" -ge 00 -o "$foo" -le 06 ] ; then
> echo "true"; fi }
> end
> end
>
> I have created following directory structure
>
> /etc/puppet/modules/common
> /etc/puppet/modules/common/lib/facter/curtime.rb
> /etc/puppet/modules/common/files
> /etc/puppet/modules/common/manifests/init.pp <- this file is empty
>
> on the puppet server i added the following to the /etc/puppet/
> puppet.conf
>
> pluginsync = true
> modulepath = /etc/puppet/modules
> factpath = $vardir/facts
>
> on the client i have added
> factsync = true to the puppet.conf
>
> When i run puppetd on client i can't see the new fact curtime also on
> the server i should be able to see the curtime fact under /var/lib/
> puppet/facts.
>
> I am running puppetmasterd and client - 0.25.4
>
> Any help would be appreciated.
----
1 - Suggest that you use ruby language instead of trying to do things in shell
2 - Suggest that you use 'irb' to troubleshoot ruby language segments
for example...
irb(main):002:0> foo = `date +%k`
=> " 8\n"
irb(main):003:0> foo = (`date +%k`).chomp
=> " 8"
irb(main):004:0> if foo <= 6 then foo -= 6
irb(main):005:1> foo
irb(main):006:1> end
ArgumentError: comparison of String with 6 failed
from (irb):4:in `<='
from (irb):4
from :0
irb(main):008:0> foo
=> " 8"
irb(main):009:0> foo = foo.to_i
=> 8
irb(main):010:0> foo <= 6 ? foo : foo -= 6
=> 2
Hope this helps
Craig
--
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.