Why not make your fact a function? This way it will only run on the master and you will use a return value in your manifests instead of facts.
On Sun, Oct 13, 2013 at 10:42 PM, Sans <r.santanu....@gmail.com> wrote: > Hi Wolf, > > yes, the custom fact itself is working just fine, so that's not a prob at > all. It's something like this: > >> inFile = "/home/admin/OSs.txt" >> gos = {} >> >> if File.exist?(inFile) >> open(inFile, 'r').each do |line| >> next if line =~ /^\s*(#|$)/ >> parts = line.split(',').map(&:strip) >> >> case parts[1] >> when /^Mac/ >> (gos[:mac] ||= []) << parts[0] >> when /_Win$/ >> (gos[:win] ||= []) << parts[0] >> else >> (gos[:linux] ||= []) << parts[0] >> >> end >> end >> end >> >> Facter.add(:am_running_oss) do >> has_weight 100 >> if gos.count >= 1 >> setcode { gos.keys.join(',') } >> else >> setcode { 'undefined' } >> end >> end > > > > As you can see, the problem is the very first line. > BTW, w.r.t. "provisioning system", it's a bit of mess at the moment and I > don't wanna touch it before the demo, that we have in two weeks time. It's a > ENC based system, which we replaced by a master-less Puppet (for AWS) > implementation and then back to old ENC system again as we started having > problem with our cloud provisioning. So, right now, it does ship the file on > to the PM and whatever the extra stuff I'm putting in doing from modules; > one of the modules needs that file available on every host for that > custom-fact to work. Thanks anyway. Cheers!! > > > > > > On Sunday, October 13, 2013 6:17:06 PM UTC+1, Wolf Noble wrote: >> >> Hi Santanu, >> >> custom facts should always do their work inside a setcode block. >> http://docs.puppetlabs.com/guides/custom_facts.html >> >> That has nothing to do with the issue at hand, however. >> >> If you need the file to exist before puppet's first run, have your >> provisioning system lay it down. Otherwise, you'll have the situation you're >> describing where your first puppet run's job is to set the stage for the >> rest of your runs. >> >> hth >> >> W > > -- > You received this message because you are subscribed to the Google Groups > "Puppet Users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to puppet-users+unsubscr...@googlegroups.com. > To post to this group, send email to puppet-users@googlegroups.com. > Visit this group at http://groups.google.com/group/puppet-users. > For more options, visit https://groups.google.com/groups/opt_out. -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscr...@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users. For more options, visit https://groups.google.com/groups/opt_out.