Hello...

  I just started rolling out facter 1.5.7 (from 1.5.5) on our rhel 5.x
servers and ran into http://projects.reductivelabs.com/issues/2312 .  In
a few of my fileserving classes I use the os release fact to determine
what file to serve.  e.g. ntpd.conf.5 and ntpd.conf.3 for rhel5 and
rhel3 respectively.  With the above bugfix my puppet clients now look
for ntpd.conf.5.4, which fails.  I implemented a workaround, but wanted
a cleaner solution.  What I came up with is below:


Facter.add("operatingsystemreleasemajor") do
        confine :kernel => :FreeBSD
        setcode do
                Facter::operatingsystemrelease.gsub(/-\w+/,'')
        end
end

Facter.add("operatingsystemreleasemajor") do
        confine :kernel => :Linux
        setcode do
                Facter::operatingsystemrelease.gsub(/\.\w+/,'')
        end
end


which AFAICT, could just be appended to facter/operatingsystemrelease.rb

What I get is:

[chris...@rhel54 facterlib-test]$ facter  | grep  operatingsystem
operatingsystem => RedHat
operatingsystemrelease => 5.4

[chris...@rhel54 facterlib-test]$ export
FACTERLIB=/home/chrismcc/facterlib-test/

[chris...@rhel54 facterlib-test]$ facter  | grep  operatingsystem
operatingsystem => RedHat
operatingsystemrelease => 5.4
operatingsystemreleasemajor => 5

and FreeBSD:

[chris...@freebsd63 facterlib-test]$ facter | grep operatingsystem
operatingsystem => FreeBSD
operatingsystemrelease => 6.3-RELEASE-p13
operatingsystemreleasemajor => 6.3


I only have RHEL and FreeBSD to test on, but I do not think the code
will break on other OSs like debian/solaris/etc.


What are the chances of getting this into the next facter release,
assuming others think it useful?



-- 
Christopher McCrory
 "The guy that keeps the servers running"
 
chris...@pricegrabber.com
 http://www.pricegrabber.com
 
Let's face it, there's no Hollow Earth, no robots, and
no 'mute rays.' And even if there were, waxed paper is
no defense.  I tried it.  Only tinfoil works.



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to