I don't know about 'factsync' on client 'puppet.conf 

on my puppet clients, having 
[main]
  ...
  pluginsync=true

seems to run the custom facts automatically

Craig

On Jun 29, 2011, at 2:02 PM, brijesh wrote:

> Hi Craig,
> 
> Thanks for your reply. I understand your concern about using ruby code
> instead of shell but my question how can i deploy this custom fact.
> The code has no error if i copy this fact into
> /usr/lib/ruby/1.8/facter and then run
> facter curtime it returns the output.
> 
> The only thing is how can deploy this fact to all the clients?
> 
> 
> On Jun 30, 4:52 am, Craig White <[email protected]> wrote:
>> 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.
>> 
>> ----
>> If your custom fact has any errors, the fact will never work. You don't have 
>> to go searching for 'facts' - on any particular machine you should be able 
>> to just run from cli...
>> 
>> facter (NAME OF FACT) - i.e.  facter curtime
>> 
>> I also neglected to mention that there really is no reason whatsoever to 
>> resort to shell just to do date things because ruby has a very rich 'Date' 
>> class built-in.
>> 
>> irb(main):001:0> require 'date'
>> => true
>> irb(main):002:0> d = Date.today
>> => #<Date: 4911483/2,0,2299161>
>> irb(main):003:0> y = d.wday
>> => 3
>> 
>> irb(main):001:0> require 'date'
>> => true
>> irb(main):002:0> d = Date.today
>> => #<Date: 4911483/2,0,2299161>
>> irb(main):003:0> y = d + 3
>> => #<Date: 4911489/2,0,2299161>
>> irb(main):004:0> z = y.strftime("%m-%d-%Y")
>> => "07-02-2011"
>> 
>> 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.
> 

-- 
Craig White ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  [email protected]
1.800.869.6908 ~~~~~~~~~~~~~~~~~~~~~~~~~~~ www.ttiassessments.com 

Need help communicating between generations at work to achieve your desired 
success? Let us help!

-- 
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