summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-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