summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Turnbull <james@lovedthanlost.net>2008-02-03 04:24:40 +1100
committerJames Turnbull <james@lovedthanlost.net>2008-02-03 04:24:40 +1100
commitecc1f0ca4f5f91c6e3aec6cfb3012687b7b97563 (patch)
tree0b656b9eab26a11b2f2bfec3a1e1ab62681a95eb
parent96cf3d6f46e1ca3921c632cd331fb519acb62703 (diff)
downloadfacter-ecc1f0ca4f5f91c6e3aec6cfb3012687b7b97563.tar.gz
facter-ecc1f0ca4f5f91c6e3aec6cfb3012687b7b97563.tar.xz
facter-ecc1f0ca4f5f91c6e3aec6cfb3012687b7b97563.zip
Added Ubuntu operatingsystem and operatingsystemrelease fact support
-rw-r--r--lib/facter.rb14
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/facter.rb b/lib/facter.rb
index e2ab905..b87805a 100644
--- a/lib/facter.rb
+++ b/lib/facter.rb
@@ -648,7 +648,9 @@ class Facter
Facter.add(:operatingsystem) do
confine :kernel => :linux
setcode do
- if FileTest.exists?("/etc/debian_version")
+ if Facter.lsbdistid == "Ubuntu"
+ "Ubuntu"
+ elsif FileTest.exists?("/etc/debian_version")
"Debian"
elsif FileTest.exists?("/etc/gentoo-release")
"Gentoo"
@@ -725,6 +727,16 @@ class Facter
end
Facter.add(:operatingsystemrelease) do
+ confine :operatingsystem => %w{Ubuntu}
+ setcode do
+ release = Resolution.exec('cat /etc/issue')
+ if release =~ /Ubuntu (\d+.\d+)/
+ $1
+ end
+ end
+ end
+
+ Facter.add(:operatingsystemrelease) do
setcode do Facter[:kernelrelease].value end
end