blob: a6f9c2c48e009eb30aa3b8507d3e2a60dfe6ab43 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
# 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 => %{windows}
setcode do
require 'win32ole'
version = ""
connection_string = "winmgmts://./root/cimv2"
wmi = WIN32OLE.connect(connection_string)
wmi.ExecQuery("SELECT Version from Win32_OperatingSystem").each do |ole|
version = "#{ole.Version}"
break
end
version
end
end
|