facter 2.1.0-x86-mingw32 → 2.2.0-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of facter might be problematic. Click here for more details.

Files changed (139) hide show
  1. data/COMMITTERS.md +25 -34
  2. data/CONTRIBUTING.md +27 -5
  3. data/README.md +32 -0
  4. data/ext/build_defaults.yaml +1 -1
  5. data/ext/debian/control +3 -2
  6. data/ext/osx/file_mapping.yaml +5 -0
  7. data/ext/redhat/facter.spec.erb +4 -1
  8. data/lib/facter/Cfkey.rb +2 -2
  9. data/lib/facter/architecture.rb +2 -2
  10. data/lib/facter/augeasversion.rb +2 -2
  11. data/lib/facter/blockdevices.rb +12 -12
  12. data/lib/facter/dhcp_servers.rb +4 -4
  13. data/lib/facter/domain.rb +4 -4
  14. data/lib/facter/ec2.rb +17 -0
  15. data/lib/facter/ec2/rest.rb +2 -2
  16. data/lib/facter/facterversion.rb +2 -2
  17. data/lib/facter/filesystems.rb +10 -3
  18. data/lib/facter/fqdn.rb +1 -1
  19. data/lib/facter/gid.rb +16 -0
  20. data/lib/facter/hardwareisa.rb +3 -3
  21. data/lib/facter/hardwaremodel.rb +3 -3
  22. data/lib/facter/hostname.rb +1 -1
  23. data/lib/facter/id.rb +4 -4
  24. data/lib/facter/interfaces.rb +3 -0
  25. data/lib/facter/ipaddress6.rb +9 -9
  26. data/lib/facter/kernel.rb +2 -2
  27. data/lib/facter/kernelmajversion.rb +2 -2
  28. data/lib/facter/kernelrelease.rb +4 -4
  29. data/lib/facter/kernelversion.rb +3 -3
  30. data/lib/facter/ldom.rb +11 -0
  31. data/lib/facter/lsbdistcodename.rb +8 -4
  32. data/lib/facter/lsbdistdescription.rb +6 -10
  33. data/lib/facter/lsbdistid.rb +8 -4
  34. data/lib/facter/lsbdistrelease.rb +8 -4
  35. data/lib/facter/lsbmajdistrelease.rb +7 -12
  36. data/lib/facter/lsbminordistrelease.rb +22 -0
  37. data/lib/facter/lsbrelease.rb +8 -4
  38. data/lib/facter/macaddress.rb +1 -0
  39. data/lib/facter/macosx.rb +1 -1
  40. data/lib/facter/manufacturer.rb +3 -3
  41. data/lib/facter/memory.rb +8 -8
  42. data/lib/facter/netmask.rb +2 -1
  43. data/lib/facter/network.rb +3 -3
  44. data/lib/facter/operatingsystem.rb +9 -126
  45. data/lib/facter/operatingsystem/base.rb +61 -0
  46. data/lib/facter/operatingsystem/cumuluslinux.rb +27 -0
  47. data/lib/facter/operatingsystem/implementation.rb +30 -0
  48. data/lib/facter/operatingsystem/linux.rb +467 -0
  49. data/lib/facter/operatingsystem/sunos.rb +54 -0
  50. data/lib/facter/operatingsystem/vmkernel.rb +11 -0
  51. data/lib/facter/operatingsystem/windows.rb +37 -0
  52. data/lib/facter/operatingsystemmajrelease.rb +14 -33
  53. data/lib/facter/operatingsystemrelease.rb +14 -235
  54. data/lib/facter/os.rb +69 -0
  55. data/lib/facter/osfamily.rb +4 -23
  56. data/lib/facter/partitions.rb +4 -3
  57. data/lib/facter/path.rb +2 -2
  58. data/lib/facter/physicalprocessorcount.rb +10 -74
  59. data/lib/facter/processor.rb +13 -129
  60. data/lib/facter/processors.rb +60 -0
  61. data/lib/facter/processors/os.rb +234 -0
  62. data/lib/facter/ps.rb +5 -4
  63. data/lib/facter/puppetversion.rb +1 -1
  64. data/lib/facter/rackspace.rb +34 -0
  65. data/lib/facter/rubysitedir.rb +3 -0
  66. data/lib/facter/rubyversion.rb +2 -2
  67. data/lib/facter/selinux.rb +57 -2
  68. data/lib/facter/ssh.rb +1 -0
  69. data/lib/facter/system_uptime.rb +42 -0
  70. data/lib/facter/timezone.rb +1 -1
  71. data/lib/facter/uptime.rb +5 -23
  72. data/lib/facter/uptime_days.rb +4 -6
  73. data/lib/facter/uptime_hours.rb +4 -6
  74. data/lib/facter/uptime_seconds.rb +5 -9
  75. data/lib/facter/util/formatter.rb +1 -1
  76. data/lib/facter/util/manufacturer.rb +1 -1
  77. data/lib/facter/util/partitions.rb +3 -1
  78. data/lib/facter/util/partitions/linux.rb +1 -1
  79. data/lib/facter/util/partitions/openbsd.rb +35 -0
  80. data/lib/facter/util/uptime.rb +4 -3
  81. data/lib/facter/util/virtual.rb +3 -1
  82. data/lib/facter/util/xendomains.rb +12 -3
  83. data/lib/facter/version.rb +1 -1
  84. data/lib/facter/virtual.rb +24 -23
  85. data/lib/facter/vlans.rb +1 -1
  86. data/lib/facter/xendomains.rb +1 -1
  87. data/lib/facter/zfs_version.rb +6 -2
  88. data/lib/facter/zones.rb +6 -5
  89. data/lib/facter/zpool_version.rb +1 -1
  90. data/spec/fixtures/cpuinfo/amd64dual-grep +2 -0
  91. data/spec/fixtures/cpuinfo/amd64twentyfour-grep +24 -0
  92. data/spec/fixtures/cpuinfo/two_multicore-grep +4 -0
  93. data/spec/fixtures/cpuinfo/two_singlecore-grep +2 -0
  94. data/spec/fixtures/unit/processors/os/darwin-system-profiler +287 -0
  95. data/spec/fixtures/unit/zfs_version/zfs_new +61 -0
  96. data/spec/fixtures/unit/zfs_version/zfs_old +43 -0
  97. data/spec/fixtures/unit/zfs_version/zfsonlinux_0.6.1 +13 -0
  98. data/spec/fixtures/unit/zpool_version/zfsonlinux_0.6.1 +48 -0
  99. data/spec/unit/ec2/rest_spec.rb +6 -6
  100. data/spec/unit/gid_spec.rb +22 -0
  101. data/spec/unit/hardwaremodel_spec.rb +2 -0
  102. data/spec/unit/lsbdistcodename_spec.rb +22 -17
  103. data/spec/unit/lsbdistdescription_spec.rb +22 -17
  104. data/spec/unit/lsbdistid_spec.rb +23 -18
  105. data/spec/unit/lsbdistrelease_spec.rb +22 -17
  106. data/spec/unit/lsbmajdistrelease_spec.rb +23 -6
  107. data/spec/unit/lsbminordistrelease_spec.rb +31 -0
  108. data/spec/unit/lsbrelease_spec.rb +22 -17
  109. data/spec/unit/macaddress_spec.rb +3 -0
  110. data/spec/unit/operatingsystem/base_spec.rb +76 -0
  111. data/spec/unit/operatingsystem/cumuluslinux_spec.rb +40 -0
  112. data/spec/unit/operatingsystem/implementation_spec.rb +49 -0
  113. data/spec/unit/operatingsystem/linux_spec.rb +538 -0
  114. data/spec/unit/operatingsystem/sunos_spec.rb +144 -0
  115. data/spec/unit/operatingsystem/vmkernel_spec.rb +13 -0
  116. data/spec/unit/operatingsystem/windows_spec.rb +68 -0
  117. data/spec/unit/operatingsystem_spec.rb +10 -153
  118. data/spec/unit/operatingsystemmajrelease_spec.rb +14 -31
  119. data/spec/unit/operatingsystemrelease_spec.rb +13 -229
  120. data/spec/unit/os_spec.rb +131 -0
  121. data/spec/unit/osfamily_spec.rb +9 -54
  122. data/spec/unit/partitions_spec.rb +41 -3
  123. data/spec/unit/physicalprocessorcount_spec.rb +6 -78
  124. data/spec/unit/processor_spec.rb +18 -381
  125. data/spec/unit/processors/os_spec.rb +446 -0
  126. data/spec/unit/processors_spec.rb +203 -0
  127. data/spec/unit/rackspace_spec.rb +40 -0
  128. data/spec/unit/system_uptime_spec.rb +80 -0
  129. data/spec/unit/util/formatter_spec.rb +5 -0
  130. data/spec/unit/util/macaddress_spec.rb +2 -0
  131. data/spec/unit/util/processor_spec.rb +120 -0
  132. data/spec/unit/util/uptime_spec.rb +3 -4
  133. data/spec/unit/util/virtual_spec.rb +8 -0
  134. data/spec/unit/util/xendomains_spec.rb +54 -9
  135. data/spec/unit/virtual_spec.rb +8 -1
  136. data/spec/unit/zfs_version_spec.rb +20 -8
  137. data/spec/unit/zpool_version_spec.rb +5 -0
  138. metadata +660 -589
  139. checksums.yaml +0 -7
@@ -0,0 +1,54 @@
1
+ require 'facter/util/file_read'
2
+ require 'facter/operatingsystem/base'
3
+
4
+ module Facter
5
+ module Operatingsystem
6
+ class SunOS < Base
7
+ def get_operatingsystem
8
+ output = Facter::Core::Execution.exec('uname -v')
9
+ if output =~ /^joyent_/
10
+ "SmartOS"
11
+ elsif output =~ /^oi_/
12
+ "OpenIndiana"
13
+ elsif output =~ /^omnios-/
14
+ "OmniOS"
15
+ elsif FileTest.exists?("/etc/debian_version")
16
+ "Nexenta"
17
+ else
18
+ "Solaris"
19
+ end
20
+ end
21
+
22
+ def get_osfamily
23
+ "Solaris"
24
+ end
25
+
26
+ def get_operatingsystemrelease
27
+ if release = Facter::Util::FileRead.read('/etc/release')
28
+ line = release.split("\n").first
29
+
30
+ # Solaris 10: Solaris 10 10/09 s10x_u8wos_08a X86
31
+ # Solaris 11 (old naming scheme): Oracle Solaris 11 11/11 X86
32
+ # Solaris 11 (new naming scheme): Oracle Solaris 11.1 SPARC
33
+ if match = /\s+s(\d+)[sx]?(_u\d+)?.*(?:SPARC|X86)/.match(line)
34
+ match.captures.join('')
35
+ elsif match = /Solaris ([0-9\.]+(?:\s*[0-9\.\/]+))\s*(?:SPARC|X86)/.match(line)
36
+ match.captures[0]
37
+ else
38
+ Facter[:kernelrelease].value
39
+ end
40
+ else
41
+ Facter[:kernelrelease].value
42
+ end
43
+ end
44
+
45
+ def get_operatingsystemmajrelease
46
+ if get_operatingsystem == "Solaris"
47
+ if match = get_operatingsystemrelease.match(/^(\d+)/)
48
+ match.captures[0]
49
+ end
50
+ end
51
+ end
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,11 @@
1
+ require 'facter/operatingsystem/base'
2
+
3
+ module Facter
4
+ module Operatingsystem
5
+ class VMkernel < Base
6
+ def get_operatingsystem
7
+ "ESXi"
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,37 @@
1
+ require 'facter/operatingsystem/base'
2
+
3
+ module Facter
4
+ module Operatingsystem
5
+ class Windows < Base
6
+ def get_operatingsystemrelease
7
+ require 'facter/util/wmi'
8
+ result = nil
9
+ Facter::Util::WMI.execquery("SELECT version, producttype FROM Win32_OperatingSystem").each do |os|
10
+ result =
11
+ case os.version
12
+ when /^6\.2/
13
+ os.producttype == 1 ? "8" : "2012"
14
+ when /^6\.1/
15
+ os.producttype == 1 ? "7" : "2008 R2"
16
+ when /^6\.0/
17
+ os.producttype == 1 ? "Vista" : "2008"
18
+ when /^5\.2/
19
+ if os.producttype == 1
20
+ "XP"
21
+ else
22
+ begin
23
+ os.othertypedescription == "R2" ? "2003 R2" : "2003"
24
+ rescue NoMethodError
25
+ "2003"
26
+ end
27
+ end
28
+ else
29
+ Facter[:kernelrelease].value
30
+ end
31
+ break
32
+ end
33
+ result
34
+ end
35
+ end
36
+ end
37
+ end
@@ -3,45 +3,26 @@
3
3
  # Purpose: Returns the major release of the operating system.
4
4
  #
5
5
  # Resolution:
6
- # Splits down the operatingsystemrelease fact at decimal point for
6
+ # Uses the releasemajor key of the os structured fact, which itself
7
+ # splits down its operatingsystemrelease key at decimal point for
7
8
  # osfamily RedHat derivatives and Debian.
8
- # Uses operatingsystemrelease to the first non decimal character for
9
- # operatingsystem Solaris
9
+ # Uses operatingsystemrelease key to the first non decimal
10
+ # character for operatingsystem Solaris.
10
11
  #
11
- # This should be the same as lsbmajdistrelease, but on minimal systems there
12
- # are too many dependencies to use LSB
12
+ # This should be the same as lsbmajdistrelease, but on minimal systems there
13
+ # are too many dependencies to use LSB
13
14
  #
14
15
  # List of operatingsystems at time of writing:
15
- #"Alpine" "Amazon" "Archlinux" "Ascendos" "Bluewhite64" "CentOS" "CloudLinux"
16
- #"Debian" "Fedora" "Gentoo" "Mandrake" "Mandriva" "MeeGo" "OEL" "OpenSuSE"
17
- #"OracleLinux" "OVS" "PSBM" "RedHat" "Scientific" "Slackware" "Slamd64" "SLC"
18
- #"SLED" "SLES" "SuSE" "Ubuntu" "VMWareESX"
16
+ # "Alpine" "Amazon" "Archlinux" "Ascendos" "Bluewhite64" "CentOS" "CloudLinux"
17
+ # "Debian" "Fedora" "Gentoo" "Mandrake" "Mandriva" "MeeGo" "OEL" "OpenSuSE"
18
+ # "OracleLinux" "OVS" "PSBM" "RedHat" "Scientific" "Slackware" "Slamd64" "SLC"
19
+ # "SLED" "SLES" "SuSE" "Ubuntu" "VMWareESX"
20
+ #
19
21
 
20
22
  Facter.add(:operatingsystemmajrelease) do
21
- confine :operatingsystem => [
22
- :Amazon,
23
- :CentOS,
24
- :CloudLinux,
25
- :Debian,
26
- :Fedora,
27
- :OEL,
28
- :OracleLinux,
29
- :OVS,
30
- :RedHat,
31
- :Scientific,
32
- :SLC,
33
- :CumulusLinux
34
- ]
35
- setcode do
36
- Facter.value('operatingsystemrelease').split('.').first
23
+ confine do
24
+ !Facter.value("os")["release"]["major"].nil?
37
25
  end
38
- end
39
26
 
40
- Facter.add(:operatingsystemmajrelease) do
41
- confine :operatingsystem => :solaris
42
- setcode do
43
- if match = Facter.value(:operatingsystemrelease).match(/^(\d+)/)
44
- match.captures[0]
45
- end
46
- end
27
+ setcode { Facter.value("os")["release"]["major"].to_s }
47
28
  end
@@ -3,248 +3,27 @@
3
3
  # Purpose: Returns the release of the operating system.
4
4
  #
5
5
  # Resolution:
6
- # On RedHat derivatives, returns their '/etc/<variant>-release' file.
7
- # On Debian, returns '/etc/debian_version'.
8
- # On Ubuntu, parses '/etc/lsb-release' for the release version.
9
- # On Suse, derivatives, parses '/etc/SuSE-release' for a selection of version
6
+ # Uses the release key of the os structured hash, which itself
7
+ # operates on the following conditions:
8
+ #
9
+ # On RedHat derivatives, returns their `/etc/<variant>-release` file.
10
+ # On Debian, returns `/etc/debian_version`.
11
+ # On Ubuntu, parses `/etc/lsb-release` for the release version.
12
+ # On Suse, derivatives, parses `/etc/SuSE-release` for a selection of version
10
13
  # information.
11
- # On Slackware, parses '/etc/slackware-version'.
12
- # On Amazon Linux, returns the 'lsbdistrelease' value.
13
- # On Mageia, parses '/etc/mageia-release' for the release version.
14
+ # On Slackware, parses `/etc/slackware-version`.
15
+ # On Amazon Linux, returns the `lsbdistrelease` value.
16
+ # On Mageia, parses `/etc/mageia-release` for the release version.
14
17
  #
15
- # On all remaining systems, returns the 'kernelrelease' value.
18
+ # On all remaining systems, returns the kernelrelease fact's value.
16
19
  #
17
20
  # Caveats:
18
21
  #
19
22
 
20
- require 'facter/util/operatingsystem'
21
- require 'facter/util/file_read'
22
-
23
- Facter.add(:operatingsystemrelease) do
24
- confine :operatingsystem => %w{CentOS Fedora oel ovs OracleLinux RedHat MeeGo Scientific SLC Ascendos CloudLinux PSBM}
25
- setcode do
26
- case Facter.value(:operatingsystem)
27
- when "CentOS", "RedHat", "Scientific", "SLC", "Ascendos", "CloudLinux", "PSBM", "XenServer"
28
- releasefile = "/etc/redhat-release"
29
- when "Fedora"
30
- releasefile = "/etc/fedora-release"
31
- when "MeeGo"
32
- releasefile = "/etc/meego-release"
33
- when "OracleLinux"
34
- releasefile = "/etc/oracle-release"
35
- when "OEL", "oel"
36
- releasefile = "/etc/enterprise-release"
37
- when "OVS", "ovs"
38
- releasefile = "/etc/ovs-release"
39
- end
40
-
41
- if release = Facter::Util::FileRead.read(releasefile)
42
- line = release.split("\n").first.chomp
43
- if match = /\(Rawhide\)$/.match(line)
44
- "Rawhide"
45
- elsif match = /release (\d[\d.]*)/.match(line)
46
- match[1]
47
- end
48
- end
49
- end
50
- end
51
-
52
- Facter.add(:operatingsystemrelease) do
53
- confine :operatingsystem => %w{Debian}
54
- setcode do
55
- if release = Facter::Util::FileRead.read('/etc/debian_version')
56
- release.sub!(/\s*$/, '')
57
- release
58
- end
59
- end
60
- end
61
-
62
- Facter.add(:operatingsystemrelease) do
63
- confine :operatingsystem => %w{Ubuntu}
64
- setcode do
65
- if release = Facter::Util::FileRead.read('/etc/lsb-release')
66
- if match = release.match(/DISTRIB_RELEASE=((\d+.\d+)(\.(\d+))?)/)
67
- # Return only the major and minor version numbers. This behavior must
68
- # be preserved for compatibility reasons.
69
- match[2]
70
- end
71
- end
72
- end
73
- end
74
-
75
- Facter.add(:operatingsystemrelease) do
76
- confine :operatingsystem => 'LinuxMint'
77
- setcode do
78
- if release = Facter::Util::FileRead.read('/etc/linuxmint/info')
79
- if match = release.match(/RELEASE\=(\d+)/)
80
- match[1]
81
- end
82
- end
83
- end
84
- end
85
-
86
- Facter.add(:operatingsystemrelease) do
87
- confine :operatingsystem => 'CumulusLinux'
88
- setcode do
89
- Facter::Util::Operatingsystem.os_release['VERSION_ID']
90
- end
91
- end
92
-
93
- Facter.add(:operatingsystemrelease) do
94
- confine :operatingsystem => %w{SLES SLED OpenSuSE}
95
- setcode do
96
- if release = Facter::Util::FileRead.read('/etc/SuSE-release')
97
- if match = /^VERSION\s*=\s*(\d+)/.match(release)
98
- releasemajor = match[1]
99
- if match = /^PATCHLEVEL\s*=\s*(\d+)/.match(release)
100
- releaseminor = match[1]
101
- elsif match = /^VERSION\s=.*.(\d+)/.match(release)
102
- releaseminor = match[1]
103
- else
104
- releaseminor = "0"
105
- end
106
- releasemajor + "." + releaseminor
107
- else
108
- "unknown"
109
- end
110
- end
111
- end
112
- end
113
-
114
- Facter.add(:operatingsystemrelease) do
115
- confine :operatingsystem => %w{OpenWrt}
116
- setcode do
117
- if release = Facter::Util::FileRead.read('/etc/openwrt_version')
118
- if match = /^(\d+\.\d+.*)/.match(release)
119
- match[1]
120
- end
121
- end
122
- end
123
- end
124
-
125
- Facter.add(:operatingsystemrelease) do
126
- confine :operatingsystem => %w{Slackware}
127
- setcode do
128
- if release = Facter::Util::FileRead.read('/etc/slackware-version')
129
- if match = /Slackware ([0-9.]+)/.match(release)
130
- match[1]
131
- end
132
- end
133
- end
134
- end
135
-
136
- Facter.add(:operatingsystemrelease) do
137
- confine :operatingsystem => %w{Mageia}
138
- setcode do
139
- if release = Facter::Util::FileRead.read('/etc/mageia-release')
140
- if match = /Mageia release ([0-9.]+)/.match(release)
141
- match[1]
142
- end
143
- end
144
- end
145
- end
146
-
147
- Facter.add(:operatingsystemrelease) do
148
- confine :operatingsystem => %w{Bluewhite64}
149
- setcode do
150
- if release = Facter::Util::FileRead.read('/etc/bluewhite64-version')
151
- if match = /^\s*\w+\s+(\d+)\.(\d+)/.match(release)
152
- match[1] + "." + match[2]
153
- else
154
- "unknown"
155
- end
156
- end
157
- end
158
- end
159
-
160
- Facter.add(:operatingsystemrelease) do
161
- confine :operatingsystem => %w{VMwareESX}
162
- setcode do
163
- release = Facter::Core::Execution.exec('vmware -v')
164
- if match = /VMware ESX .*?(\d.*)/.match(release)
165
- match[1]
166
- end
167
- end
168
- end
169
-
170
- Facter.add(:operatingsystemrelease) do
171
- confine :operatingsystem => %w{Slamd64}
172
- setcode do
173
- if release = Facter::Util::FileRead.read('/etc/slamd64-version')
174
- if match = /^\s*\w+\s+(\d+)\.(\d+)/.match(release)
175
- match[1] + "." + match[2]
176
- else
177
- "unknown"
178
- end
179
- end
180
- end
181
- end
182
-
183
- Facter.add(:operatingsystemrelease) do
184
- confine :operatingsystem => :Alpine
185
- setcode do
186
- if release = Facter::Util::FileRead.read('/etc/alpine-release')
187
- release.sub!(/\s*$/, '')
188
- release
189
- end
190
- end
191
- end
192
-
193
- Facter.add(:operatingsystemrelease) do
194
- confine :operatingsystem => %W{Amazon}
195
- setcode do Facter[:lsbdistrelease].value end
196
- end
197
-
198
- Facter.add(:operatingsystemrelease) do
199
- confine :osfamily => :solaris
200
- setcode do
201
- if release = Facter::Util::FileRead.read('/etc/release')
202
- line = release.split("\n").first.chomp
203
- # Solaris 10: Solaris 10 10/09 s10x_u8wos_08a X86
204
- # Solaris 11 (old naming scheme): Oracle Solaris 11 11/11 X86
205
- # Solaris 11 (new naming scheme): Oracle Solaris 11.1 SPARC
206
- if match = /\s+s(\d+)[sx]?(_u\d+)?.*(?:SPARC|X86)/.match(line)
207
- match.captures.join('')
208
- elsif match = /Solaris ([0-9\.]+(?:\s*[0-9\.\/]+))\s*(?:SPARC|X86)/.match(line)
209
- match.captures[0]
210
- end
211
- end
212
- end
213
- end
214
-
215
23
  Facter.add(:operatingsystemrelease) do
216
- confine :operatingsystem => :windows
217
- setcode do
218
- require 'facter/util/wmi'
219
- result = nil
220
- Facter::Util::WMI.execquery("SELECT version, producttype FROM Win32_OperatingSystem").each do |os|
221
- result =
222
- case os.version
223
- when /^6\.2/
224
- os.producttype == 1 ? "8" : "2012"
225
- when /^6\.1/
226
- os.producttype == 1 ? "7" : "2008 R2"
227
- when /^6\.0/
228
- os.producttype == 1 ? "Vista" : "2008"
229
- when /^5\.2/
230
- if os.producttype == 1
231
- "XP"
232
- else
233
- begin
234
- os.othertypedescription == "R2" ? "2003 R2" : "2003"
235
- rescue NoMethodError
236
- "2003"
237
- end
238
- end
239
- else
240
- Facter[:kernelrelease].value
241
- end
242
- break
243
- end
244
- result
24
+ confine do
25
+ !Facter.value("os")["release"]["full"].nil?
245
26
  end
246
- end
247
27
 
248
- Facter.add(:operatingsystemrelease) do
249
- setcode do Facter[:kernelrelease].value end
28
+ setcode { Facter.value("os")["release"]["full"].to_s }
250
29
  end
@@ -0,0 +1,69 @@
1
+ # Fact: os
2
+ #
3
+ # Purpose:
4
+ # Return various facts related to the machine's operating system.
5
+ #
6
+ # Resolution:
7
+ # For operatingsystem, if the kernel is a Linux kernel, check for the
8
+ # existence of a selection of files in `/etc` to find the specific flavor.
9
+ # On SunOS based kernels, attempt to determine the flavor, otherwise return Solaris.
10
+ # On systems other than Linux, use the kernel value.
11
+ #
12
+ # For operatingsystemrelease, on RedHat derivatives, we return their `/etc/<varient>-release` file.
13
+ # On Debian, returns `/etc/debian_version`.
14
+ # On Ubuntu, parses `/etc/lsb-release` for the release version
15
+ # On Suse and derivatives, parses `/etc/SuSE-release` for a selection of version information.
16
+ # On Slackware, parses `/etc/slackware-version`.
17
+ # On Amazon Linux, returns the lsbdistrelease fact's value.
18
+ # On Mageia, parses `/etc/mageia-release` for the release version.
19
+ # On all remaining systems, returns the kernelrelease fact's value.
20
+ #
21
+ # For the lsb facts, uses the `lsb_release` system command.
22
+ #
23
+ # Caveats:
24
+ # Lsb facts only work on Linux (and the kfreebsd derivative) systems.
25
+ # Requires the `lsb_release` program, which may not be installed by default.
26
+ # It is only as accurate as the ourput of lsb_release.
27
+ #
28
+
29
+ require 'facter/operatingsystem/implementation'
30
+
31
+ Facter.add(:os, :type => :aggregate) do
32
+ def os
33
+ @os ||= Facter::Operatingsystem.implementation
34
+ end
35
+
36
+ chunk(:name) do
37
+ os_hash = {}
38
+ if (operatingsystem = os.get_operatingsystem)
39
+ os_hash["name"] = operatingsystem
40
+ os_hash
41
+ end
42
+ end
43
+
44
+ chunk(:family) do
45
+ os_hash = {}
46
+ if (osfamily = os.get_osfamily)
47
+ os_hash["family"] = osfamily
48
+ os_hash
49
+ end
50
+ end
51
+
52
+ chunk(:release) do
53
+ os_hash = {}
54
+ if (releasedata = os.get_operatingsystemrelease_hash)
55
+ os_hash["release"] = releasedata
56
+ os_hash unless os_hash["release"].empty?
57
+ end
58
+ end
59
+
60
+ chunk(:lsb) do
61
+ os_hash = {}
62
+ if os.has_lsb?
63
+ if (lsbdata = os.get_lsb_facts_hash)
64
+ os_hash["lsb"] = lsbdata
65
+ os_hash unless os_hash["lsb"].empty?
66
+ end
67
+ end
68
+ end
69
+ end