[Puppet Users] Re: Are facts cached?

Mohamed Lrhazi
Mon, 18 Apr 2011 01:45:19 -0000

I removed my call to strip(), and somehow the old buggy facts still appear:

The custom fact that generates extra custom facts:

bash-3.00# cat /var/opt/csw/puppet/lib/facter/host_facts.rb
if File.exists?(''/GU/facts.txt'')
   File.open(''/GU/facts.txt'').each do |line|
      var = nil
      value = nil

      var = $1 and val = $2 if line =~ /^(.+)=(.+)$/

      if var != nil && val != nil
         Facter.add(var) do
            setcode { val }
         end
      end
   end
end

bash-3.00# cat /GU/facts.txt
gu_environment=unset
gu_app_oracle_rac=unset
gu_app_oracle_oem=unset
gu_app_gdoc=unset
gu_app_banner=unset
gu_app_bboard=unset

the buggy facts:
bash-3.00# cat /etc/mcollective/facts.yaml|grep gu_
  "gu_app_bboard       ": unset
  gu_app_oracle_rac: unset
  gu_app_gdoc: unset
  "gu_app_oracle_oem   ": unset
  gu_app_banner: unset
  "gu_environment      ": unset


Any pointers highly appreciated.
Thanks.

On Sun, Apr 17, 2011 at 9:29 PM, Mohamed Lrhazi <lrhazi@gmail.com>
wrote:
> Am trying to debug a weird issue...It seems that my custom facts
> generated when puppet agent is run against my test master are not the
> same as when run against my prod master. What could explain that?
>
> A bit more specifically, my custom facts are generated by the fact:
>
http://www.devco.net/archives/2008/04/17/easy_per-machine_custom_facts_for_puppet.php
>
> I changed one line to allow for whitespace in the keys and values, like
this:
>
> var = $1.strip and val = $2.strip if line =~ /^(.+)=(.+)$/
>
> I synced up the configs between my test and prod masters, so
> everything should be the same... Still, when I run an agent against my
> test server I get correct facts, key1: val1... against prod master I
> get some buggy "key1    ": val1
>
> I even removed all whitespace from my facts.txt, that the facts are
> generated out of, run the agent many times, still same behavior.
>
> Any idea what could be the cause? am sure its something left over for
> my earlier attempts.. but what?
>
> Thanks a lot.
> Mohamed.