lib/facter/operatingsystemrelease.rb in facter-1.5.3 vs lib/facter/operatingsystemrelease.rb in facter-1.5.4
- old
+ new
@@ -25,10 +25,34 @@
end
end
end
Facter.add(:operatingsystemrelease) do
+ confine :operatingsystem => :oel
+ setcode do
+ File::open("/etc/enterprise-release", "r") do |f|
+ line = f.readline.chomp
+ if line =~ /release (\d+)/
+ $1
+ end
+ end
+ end
+end
+
+Facter.add(:operatingsystemrelease) do
+ confine :operatingsystem => :ovs
+ setcode do
+ File::open("/etc/ovs-release", "r") do |f|
+ line = f.readline.chomp
+ if line =~ /release (\d+)/
+ $1
+ end
+ end
+ end
+end
+
+Facter.add(:operatingsystemrelease) do
confine :operatingsystem => %w{CentOS}
setcode do
centos_release = Facter::Util::Resolution.exec("sed -r -e 's/CentOS release //' -e 's/ \((Branch|Final)\)//' /etc/redhat-release")
if centos_release =~ /5/
release = Facter::Util::Resolution.exec('rpm -q --qf \'%{VERSION}.%{RELEASE}\' centos-release | cut -d. -f1,2')
@@ -70,16 +94,9 @@
end
releasemajor + "." + releaseminor
else
"unknown"
end
- end
-end
-
-Facter.add(:operatingsystemrelease) do
- confine :operatingsystem => %w{Solaris}
- setcode do
- release = Facter::Util::Resolution.exec('uname -v')
end
end
Facter.add(:operatingsystemrelease) do
setcode do Facter[:kernelrelease].value end