Hi All

Background:
I am running Puppet to configure ESX 3.5 servers by NFS mounting the Puppet
binaries and configuration from a shared server. This is to ensure VMware
don't come back refusing support for installing non standard software on the
server.

# ruby -v
ruby 1.8.7 (2009-04-08 patchlevel 160) [i686-linux]
# facter -v
1.5.5

RUBYLIB=/apps/puppet/puppet/lib:/apps/puppet/facter/lib:/data/puppet/lib

I have 2 custom Ruby fact files in /data/puppet/lib/facter which follow
http://reductivelabs.com/trac/puppet/wiki/AddingFacts

dc_loc.rb (http://pastie.org/530294) - reads a file generated during a
kickstart with the Kickstart environment in name=value pairs and makes them
facts. Generates the important "location" fact.

facts.rb (http://pastie.org/530296) - Uses the "location" fact to load up
location specific file with site specific configuration. It uses the rescue
call as describe in "Adding Facts":
begin
    Facter.location
rescue
    Facter.loadfacts()  # Line 22
end

Most of the time, facter works
# facter
architecture => i386
.
esx_version => 3.5.0u3
facterversion => 1.5.5
.
.
location => HERE
.
.

However, sometimes, some servers (I can't see a pattern yet) will have
facter go into an infinite loop until there is no more memory. The only way
I have been able to reproduce it, is with renaming the files. NB The files
originally were named with the "AAA" prefix (actual TLA hidden to protect
the innocent)

AAA_dc_loc.rb
AAA_facts.rb

# facter
/apps/puppet/facter/lib/facter/util/ip.rb:60:in ``': Cannot allocate memory
- /sbin/ifconfig -a (Errno::ENOMEM)
        from /apps/puppet/facter/lib/facter/util/ip.rb:60:in
`get_all_interface_output'
        from /apps/puppet/facter/lib/facter/util/ip.rb:48:in
`get_interfaces'
        from /apps/puppet/facter/lib/facter/interfaces.rb:20
        from /apps/puppet/facter/lib/facter/util/loader.rb:72:in `load'
        from /apps/puppet/facter/lib/facter/util/loader.rb:72:in `load_file'
        from /apps/puppet/facter/lib/facter/util/loader.rb:38:in `load_all'
        from /apps/puppet/facter/lib/facter/util/loader.rb:33:in `each'
        from /apps/puppet/facter/lib/facter/util/loader.rb:33:in `load_all'
        from /apps/puppet/facter/lib/facter/util/loader.rb:30:in `each'
        from /apps/puppet/facter/lib/facter/util/loader.rb:30:in `load_all'
        from /apps/puppet/facter/lib/facter/util/collection.rb:90:in
`load_all'
        from /apps/puppet/facter/lib/facter.rb:183:in `loadfacts'
        from /data/puppet/lib/facter/AAA_facts.rb:22
        from /apps/puppet/facter/lib/facter/util/loader.rb:72:in `load'
        from /apps/puppet/facter/lib/facter/util/loader.rb:72:in `load_file'
        from /apps/puppet/facter/lib/facter/util/loader.rb:38:in `load_all'
        from /apps/puppet/facter/lib/facter/util/loader.rb:33:in `each'
        from /apps/puppet/facter/lib/facter/util/loader.rb:33:in `load_all'
        from /apps/puppet/facter/lib/facter/util/loader.rb:30:in `each'
        from /apps/puppet/facter/lib/facter/util/loader.rb:30:in `load_all'
        from /apps/puppet/facter/lib/facter/util/collection.rb:90:in
`load_all'
        from /apps/puppet/facter/lib/facter.rb:183:in `loadfacts'
        from /data/puppet/lib/facter/AAA_facts.rb:22
        from /apps/puppet/facter/lib/facter/util/loader.rb:72:in `load'
        from /apps/puppet/facter/lib/facter/util/loader.rb:72:in `load_file'
        from /apps/puppet/facter/lib/facter/util/loader.rb:38:in `load_all'
        from /apps/puppet/facter/lib/facter/util/loader.rb:33:in `each'
        from /apps/puppet/facter/lib/facter/util/loader.rb:33:in `load_all'
        from /apps/puppet/facter/lib/facter/util/loader.rb:30:in `each'
        from /apps/puppet/facter/lib/facter/util/loader.rb:30:in `load_all'
        from /apps/puppet/facter/lib/facter/util/collection.rb:90:in
`load_all'
        from /apps/puppet/facter/lib/facter.rb:183:in `loadfacts'
        from /data/puppet/lib/facter/AAA_facts.rb:22
.
.
.
        from /apps/puppet/facter/lib/facter/util/collection.rb:90:in
`load_all'
        from /apps/puppet/facter/lib/facter.rb:183:in `loadfacts'
        from /data/puppet/lib/facter/AAA_facts.rb:22
        from /apps/puppet/facter/lib/facter/util/loader.rb:72:in `load'
        from /apps/puppet/facter/lib/facter/util/loader.rb:72:in `load_file'
        from /apps/puppet/facter/lib/facter/util/loader.rb:38:in `load_all'
        from /apps/puppet/facter/lib/facter/util/loader.rb:33:in `each'
        from /apps/puppet/facter/lib/facter/util/loader.rb:33:in `load_all'
        from /apps/puppet/facter/lib/facter/util/loader.rb:30:in `each'
        from /apps/puppet/facter/lib/facter/util/loader.rb:30:in `load_all'
        from /apps/puppet/facter/lib/facter/util/collection.rb:90:in
`load_all'
        from /apps/puppet/facter/lib/facter.rb:91:in `to_hash'
        from /apps/puppet/facter/bin/facter:138

So, as we can see, line 22 of AAA_facts.rb is the rescue loadfacts(), which
keep trying to load the same file AAA_site_facts.rb

Then, I rename the files back to the original names without the prefix:
# ls -1
dc_loc.rb
facts.rb

and facter runs OK.

So, I think, maybe something in the file name - so I rename them as their
roles have evolved:
# mv dc_loc.rb ks_facts.rb
# mv facts.rb site_facts.rb
# ls -1
ks_facts.rb
site_facts.rb

now facter infinitely loops again.

So, I think maybe it is the order of the files in the directory, and rename
them:
# mv ks_facts.rb 002-ks_facts.rb
# mv site_facts.rb 001-site_facts.rb
# ls -1
001-site_facts.rb
002-ks_facts.rb

and facter infinitely loops again.

This is driving me nuts. I must be doing something wrong here for file names
to affect facter running.

Any pointers or help would be appreciated here! Note that this is my first
foray into Ruby & Puppet, so I am sure there is room for improvement

Thanks

John

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