blob: 365954166b8c1eda57dc320879015a1f9492c86c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
# Fact: lsbmajdistrelease
#
# Purpose: Returns the major version of the operation system version as gleaned
# from the lsbdistrelease fact.
#
# Resolution:
# Parses the lsbdistrelease fact for numbers followed by a period and
# returns those, or just the lsbdistrelease fact if none were found.
#
# Caveats:
#
# lsbmajdistrelease.rb
#
require 'facter'
Facter.add("lsbmajdistrelease") do
confine :operatingsystem => %w{Linux Fedora RedHat CentOS SuSE SLES Debian Ubuntu Gentoo OEL OVS GNU/kFreeBSD}
setcode do
if /(\d*)\./i =~ Facter.value(:lsbdistrelease)
result=$1
else
result=Facter.value(:lsbdistrelease)
end
result
end
end
|