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: [chrismcc@rhel54 facterlib-test]$ facter | grep operatingsystem operatingsystem => RedHat operatingsystemrelease => 5.4 [chrismcc@rhel54 facterlib-test]$ export FACTERLIB=/home/chrismcc/facterlib-test/ [chrismcc@rhel54 facterlib-test]$ facter | grep operatingsystem operatingsystem => RedHat operatingsystemrelease => 5.4 operatingsystemreleasemajor => 5 and FreeBSD: [chrismcc@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" chrismcc@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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en -~----------~----~----~----~------~----~------~--~---
Ohad Levy
2009-Oct-21 02:45 UTC
[Puppet Users] Re: Facter 1.5.7 and operatingsystemrelease
Hi, I for one, thinks that the operatingsystemrelease fact should contain only the major number of the operating system, e.g. for Centos/Rehat 5.4 it should return just 5. the reason behind it is that I rarely use the full release version as a variable, and if I do, I use the lsb facts. this change is very annoying, as it requires to change your manifest again (we had the same issue between facter 1.38 and 1.5.0). I ended up having my own fact which is just a wrapper for the operatingsystem relase, as it one point of time I might have multiple facter version running around.... Ohad On Wed, Oct 21, 2009 at 6:42 AM, Christopher <chrismcc@pricegrabber.com>wrote:> > 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: > > [chrismcc@rhel54 facterlib-test]$ facter | grep operatingsystem > operatingsystem => RedHat > operatingsystemrelease => 5.4 > > [chrismcc@rhel54 facterlib-test]$ export > FACTERLIB=/home/chrismcc/facterlib-test/ > > [chrismcc@rhel54 facterlib-test]$ facter | grep operatingsystem > operatingsystem => RedHat > operatingsystemrelease => 5.4 > operatingsystemreleasemajor => 5 > > and FreeBSD: > > [chrismcc@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" > > chrismcc@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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en -~----------~----~----~----~------~----~------~--~---
Kenton Brede
2009-Dec-22 15:17 UTC
Re: [Puppet Users] Re: Facter 1.5.7 and operatingsystemrelease
On Tue, Oct 20, 2009 at 8:45 PM, Ohad Levy <ohadlevy@gmail.com> wrote:> Hi, > > I for one, thinks that the operatingsystemrelease fact should contain only > the major number of the operating system, e.g. for Centos/Rehat 5.4 it > should return just 5. > > the reason behind it is that I rarely use the full release version as a > variable, and if I do, I use the lsb facts. > > this change is very annoying, as it requires to change your manifest again > (we had the same issue between facter 1.38 and 1.5.0). > > I ended up having my own fact which is just a wrapper for the > operatingsystem relase, as it one point of time I might have multiple facter > version running around.... >I searched through old messages and didn''t see that this had been addressed. I can see people wanting facter to report the minor version and others wanting just the major release number. The way it stands I''ll need to change every operatingystemrelease variable, each time a new minor version come out. That''s a pain I don''t need. So I''ll work around this by creating my own fact. Having two variables for the OS release seems to me a good choice. Just my 2 cents. Kent -- 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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Len Rugen
2009-Dec-23 00:28 UTC
Re: [Puppet Users] Re: Facter 1.5.7 and operatingsystemrelease
I posted a question about the lsb prefixed facts a few weeks ago. lsbmaj____ may be what you''re looking for. On Tue, Dec 22, 2009 at 9:17 AM, Kenton Brede <kbrede@gmail.com> wrote:> On Tue, Oct 20, 2009 at 8:45 PM, Ohad Levy <ohadlevy@gmail.com> wrote: > > Hi, > > > > I for one, thinks that the operatingsystemrelease fact should contain > only > > the major number of the operating system, e.g. for Centos/Rehat 5.4 it > > should return just 5. > > > > the reason behind it is that I rarely use the full release version as a > > variable, and if I do, I use the lsb facts. > > > > this change is very annoying, as it requires to change your manifest > again > > (we had the same issue between facter 1.38 and 1.5.0). > > > > I ended up having my own fact which is just a wrapper for the > > operatingsystem relase, as it one point of time I might have multiple > facter > > version running around.... > > > > I searched through old messages and didn''t see that this had been > addressed. I can see people wanting facter to report the minor > version and others wanting just the major release number. The way it > stands I''ll need to change every operatingystemrelease variable, each > time a new minor version come out. That''s a pain I don''t need. So > I''ll work around this by creating my own fact. Having two variables > for the OS release seems to me a good choice. Just my 2 cents. > Kent > > -- > > 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+unsubscribe@googlegroups.com<puppet-users%2Bunsubscribe@googlegroups.com> > . > For more options, visit this group at > http://groups.google.com/group/puppet-users?hl=en. > > >-- 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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Derek Yarnell
2009-Dec-27 00:38 UTC
Re: [Puppet Users] Facter 1.5.7 and operatingsystemrelease
I think the problem is that using the LSB stuff is unhelpful since non-Linux systems don''t support it. The issue with operatingsystemrelease is that behavior has kinda changed with rhel5 from 3 and 4. Now I realize that all it is doing is tokenizing /etc/redhat-release but i agree that this annoys the crap out of me and we implement local facts to make this better. On Tuesday, December 22, 2009, Len Rugen <lenrugen@gmail.com> wrote:> I posted a question about the lsb prefixed facts a few weeks ago. lsbmaj____ may be what you''re looking for. > > On Tue, Dec 22, 2009 at 9:17 AM, Kenton Brede <kbrede@gmail.com> wrote: > On Tue, Oct 20, 2009 at 8:45 PM, Ohad Levy <ohadlevy@gmail.com> wrote: >> Hi, >> >> I for one, thinks that the operatingsystemrelease fact should contain only >> the major number of the operating system, e.g. for Centos/Rehat 5.4 it >> should return just 5. >> >> the reason behind it is that I rarely use the full release version as a >> variable, and if I do, I use the lsb facts. >> >> this change is very annoying, as it requires to change your manifest again >> (we had the same issue between facter 1.38 and 1.5.0). >> >> I ended up having my own fact which is just a wrapper for the >> operatingsystem relase, as it one point of time I might have multiple facter >> version running around.... >> > > I searched through old messages and didn''t see that this had been > addressed. I can see people wanting facter to report the minor > version and others wanting just the major release number. The way it > stands I''ll need to change every operatingystemrelease variable, each > time a new minor version come out. That''s a pain I don''t need. So > I''ll work around this by creating my own fact. Having two variables > for the OS release seems to me a good choice. Just my 2 cents. > Kent > > -- > > 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+unsubscribe@googlegroups.com. > For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en. > > > > > > -- > > 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+unsubscribe@googlegroups.com. > For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en. >-- --- Derek T. Yarnell -- 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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Thomas Bellman
2009-Dec-28 16:42 UTC
[Puppet Users] Re: Facter 1.5.7 and operatingsystemrelease
Kenton Brede wrote:> I searched through old messages and didn''t see that this had been > addressed. I can see people wanting facter to report the minor > version and others wanting just the major release number. The way it > stands I''ll need to change every operatingystemrelease variable, each > time a new minor version come out. That''s a pain I don''t need. So > I''ll work around this by creating my own fact. Having two variables > for the OS release seems to me a good choice. Just my 2 cents.You could use the regsubst() function to mangle $operatingsystemrelease into just the major version. Something like this: $osmajor = regsubst($operatingsystemrelease, ''([^.]*)[.].*'', ''\1'') That may be simpler than having a custom fact for it. /Bellman -- 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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.