diff options
-rw-r--r-- | lib/facter.rb | 15 |
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 |