summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorluke <luke@1f5c1d6a-bddf-0310-8f58-fc49e503516a>2006-09-20 15:46:22 +0000
committerluke <luke@1f5c1d6a-bddf-0310-8f58-fc49e503516a>2006-09-20 15:46:22 +0000
commitd75744b5bc40d8f26bff72f8b8738fc41b7f8a24 (patch)
tree7c2f95ba7afa2534eebec055fcb0958970f9ba21
parentfe0f2f204fdd5d4c48af93d691cce53061cd1ded (diff)
downloadfacter-d75744b5bc40d8f26bff72f8b8738fc41b7f8a24.tar.gz
facter-d75744b5bc40d8f26bff72f8b8738fc41b7f8a24.tar.xz
facter-d75744b5bc40d8f26bff72f8b8738fc41b7f8a24.zip
Adding patch from #21, adding lsb_release facts
git-svn-id: http://reductivelabs.com/svn/facter/trunk@171 1f5c1d6a-bddf-0310-8f58-fc49e503516a
-rw-r--r--lib/facter.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/facter.rb b/lib/facter.rb
index 8a9fcc1..fd1dd42 100644
--- a/lib/facter.rb
+++ b/lib/facter.rb
@@ -608,6 +608,21 @@ class Facter
setcode 'uname -r'
end
+ {"LSBRelease" => "^LSB Version:\t(.*)$", "LSBDistId" => "^Distributor ID:\t(.*)$",
+ "LSBDistRelease" => "^Release:\t(.*)$", "LSBDistDescription" => "^Description:\t(.*)$",
+ "LSBDistCodeName" => "^Codename:\t(.*)$"}.each { |fact, pattern|
+ output = %x{lsb_release -a 2>&1}
+ if $? == 0
+ Facter.add(fact) do
+ setcode do
+ if $? == 0 and output =~ /#{pattern}/
+ $1
+ end
+ end
+ end # end of add
+ end
+ }
+
Facter.add("OperatingSystem") do
# Default to just returning the kernel as the operating system
setcode do Facter["Kernel"].value end