Sha256: 740a4390412a2d165ad4cbb5a7456fe3e032297e606e079d5e4d7f2e81e3102f

Contents?: true

Size: 951 Bytes

Versions: 15

Compression:

Stored size: 951 Bytes

Contents

# Fact: kernelrelease
#
# Purpose: Return the operating system's release number.
#
# Resolution:
#   On AIX returns the output from the "oslevel -s" system command.
#   On Windows based systems, uses the win32ole gem to query Windows Management
#   for the 'Win32_OperatingSystem' value.
#   Otherwise uses the output of "uname -r" system command.
#
# Caveats:
#

Facter.add(:kernelrelease) do
  setcode 'uname -r'
end

Facter.add(:kernelrelease) do
  confine :kernel => "aix"
  setcode 'oslevel -s'
end

Facter.add(:kernelrelease) do
  confine :kernel => "hp-ux"
  setcode do
    version = Facter::Util::Resolution.exec('uname -r') 
    version[2..-1]
  end
end

Facter.add(:kernelrelease) do
  confine :kernel => "windows"
  setcode do
    require 'facter/util/wmi'
    version = ""
    Facter::Util::WMI.execquery("SELECT Version from Win32_OperatingSystem").each do |ole|
      version = "#{ole.Version}"
      break
    end
    version
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
facter-1.7.6 lib/facter/kernelrelease.rb
facter-1.7.5 lib/facter/kernelrelease.rb
facter-1.7.5.rc2 lib/facter/kernelrelease.rb
facter-1.7.5.rc1 lib/facter/kernelrelease.rb
facter-1.7.4 lib/facter/kernelrelease.rb
facter-1.7.4.rc1 lib/facter/kernelrelease.rb
facter-1.7.3 lib/facter/kernelrelease.rb
facter-1.7.3.rc1 lib/facter/kernelrelease.rb
facter-1.7.2 lib/facter/kernelrelease.rb
facter-1.7.2.rc1 lib/facter/kernelrelease.rb
facter-1.7.1 lib/facter/kernelrelease.rb
facter-1.7.1.rc1 lib/facter/kernelrelease.rb
facter-1.7.0 lib/facter/kernelrelease.rb
facter-1.7.0.rc2 lib/facter/kernelrelease.rb
facter-1.7.0.rc1 lib/facter/kernelrelease.rb