[Pkg-puppet-devel] [SCM] Packaging of Facter for debian branch, upstream, updated. 3a39dd8353b6308cf49522990104cc63e55d7cda
Paul Nasrat
pnasrat at googlemail.com
Fri Jan 29 17:22:35 UTC 2010
The following commit has been merged in the upstream branch:
commit 545f3c1405451afecb1e79bd34e15640322162e2
Merge: 95e5fea3c7cbc9dbc6a5c77358593e872649d1df 82d97e25f14f0b92187b6ac695119ac5076c0810
Author: Todd Zullinger <tmz at pobox.com>
Date: Tue Jul 14 08:02:04 2009 +0100
Fix #2060 and cleanup operatingsystemrelease
Patch from Todd Zullinger, rebased.
Merge branch 'cleanup-operatingsystemrelease' of git://jet.mox.net/~tmz/facter
into tickets/master/2060
Conflicts:
lib/facter/operatingsystemrelease.rb
diff --combined lib/facter/operatingsystemrelease.rb
index 0864b4d,18199bd..2138d86
--- a/lib/facter/operatingsystemrelease.rb
+++ b/lib/facter/operatingsystemrelease.rb
@@@ -1,37 -1,21 +1,21 @@@
Facter.add(:operatingsystemrelease) do
- confine :operatingsystem => :fedora
+ confine :operatingsystem => %w{CentOS Fedora oel ovs RedHat}
setcode do
- File::open("/etc/fedora-release", "r") do |f|
- line = f.readline.chomp
- if line =~ /\(Rawhide\)$/
- "Rawhide"
- elsif line =~ /release (\d+)/
- $1
- end
+ case Facter.value(:operatingsystem)
+ when "CentOS", "RedHat"
+ releasefile = "/etc/redhat-release"
+ when "Fedora"
+ releasefile = "/etc/fedora-release"
+ when "oel"
+ releasefile = "/etc/enterprise-release"
+ when "ovs"
+ releasefile = "/etc/ovs-release"
end
- end
- end
-
- Facter.add(:operatingsystemrelease) do
- confine :operatingsystem => %w{RedHat}
- setcode do
- File::open("/etc/redhat-release", "r") do |f|
+ File::open(releasefile, "r") do |f|
line = f.readline.chomp
if line =~ /\(Rawhide\)$/
"Rawhide"
- elsif line =~ /release (\d+)/
- $1
- end
- 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+)/
+ elsif line =~ /release (\d[\d.]*)/
$1
end
end
@@@ -39,30 -23,6 +23,6 @@@
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')
- else
- release = centos_release
- end
- end
- end
-
- Facter.add(:operatingsystemrelease) do
confine :operatingsystem => %w{Debian}
setcode do
release = Facter::Util::Resolution.exec('cat /etc/debian_version')
@@@ -80,7 -40,7 +40,7 @@@ Facter.add(:operatingsystemrelease) d
end
Facter.add(:operatingsystemrelease) do
- confine :operatingsystem => %w{SLES OpenSuSE}
+ confine :operatingsystem => %w{SLES SLED OpenSuSE}
setcode do
releasefile = Facter::Util::Resolution.exec('cat /etc/SuSE-release')
if releasefile =~ /^VERSION\s*=\s*(\d+)/
--
Packaging of Facter for debian
More information about the Pkg-puppet-devel
mailing list