Sha256: 2d197bb7fbd9f6d70e09415ec16ba248f6266630bc44e765a7d4c9d5292e365b

Contents?: true

Size: 1.1 KB

Versions: 32

Compression:

Stored size: 1.1 KB

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:
#
require 'facter/util/posix'

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 => :openbsd
  setcode do
    Facter::Util::POSIX.sysctl("kern.version").split(' ')[1]
  end
end

Facter.add(:kernelrelease) do
  confine :kernel => "hp-ux"
  setcode do
    version = Facter::Core::Execution.execute('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

32 entries across 32 versions & 1 rubygems

Version Path
facter-2.4.6 lib/facter/kernelrelease.rb
facter-2.4.6-x86-mingw32 lib/facter/kernelrelease.rb
facter-2.4.6-x64-mingw32 lib/facter/kernelrelease.rb
facter-2.4.6-universal-darwin lib/facter/kernelrelease.rb
facter-2.4.5 lib/facter/kernelrelease.rb
facter-2.4.5-x86-mingw32 lib/facter/kernelrelease.rb
facter-2.4.5-x64-mingw32 lib/facter/kernelrelease.rb
facter-2.4.5-universal-darwin lib/facter/kernelrelease.rb
facter-2.4.4 lib/facter/kernelrelease.rb
facter-2.4.4-x86-mingw32 lib/facter/kernelrelease.rb
facter-2.4.4-x64-mingw32 lib/facter/kernelrelease.rb
facter-2.4.4-universal-darwin lib/facter/kernelrelease.rb
facter-2.4.3 lib/facter/kernelrelease.rb
facter-2.4.3-x86-mingw32 lib/facter/kernelrelease.rb
facter-2.4.3-x64-mingw32 lib/facter/kernelrelease.rb
facter-2.4.3-universal-darwin lib/facter/kernelrelease.rb
facter-2.4.1 lib/facter/kernelrelease.rb
facter-2.4.1-x86-mingw32 lib/facter/kernelrelease.rb
facter-2.4.1-x64-mingw32 lib/facter/kernelrelease.rb
facter-2.4.1-universal-darwin lib/facter/kernelrelease.rb