Gary, I've been solving this problem by using the following inline_template
in the modules that need to get the major release version:
$os_major_ver = inline_template("<%= operatingsystemrelease.split('.')[0]
%>")

I'm new to Puppet, and I like the elegance of your example below - to
implement it, would I need to put that block in
<modulename>/lib/facter/operatingsystemmajor.rb?  I assume I'd need to put
that in every module that'd use it.  Is there a better way?  I currently
use that block in 3 or 4 modules.

Thanks!
Jeffrey.

On Sun, Feb 12, 2012 at 6:25 PM, Gary Larizza <[email protected]> wrote:

> There's also the 'operatingsystemrelease' fact that will evaluate to the
> full version.  You could do this:
>
> Facter.add('operatingsystemmajor') do
>   setcode do
>     Facter.value('operatingsystemrelease').split('.').first
>   end
> end
>
>

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