facter 4.0.43 → 4.0.44
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/facter.rb +13 -2
- data/lib/facter/config.rb +354 -0
- data/lib/facter/custom_facts/util/fact.rb +1 -1
- data/lib/facter/facts/rhel/os/release.rb +1 -1
- data/lib/facter/framework/benchmarking/timer.rb +4 -2
- data/lib/facter/framework/config/fact_groups.rb +5 -5
- data/lib/facter/framework/core/cache_manager.rb +4 -1
- data/lib/facter/framework/core/options/option_store.rb +35 -19
- data/lib/facter/framework/detector/os_hierarchy.rb +5 -9
- data/lib/facter/resolvers/aix/architecture_resolver.rb +15 -1
- data/lib/facter/resolvers/augeas_resolver.rb +7 -1
- data/lib/facter/resolvers/bsd/processors.rb +11 -7
- data/lib/facter/resolvers/disk_resolver.rb +11 -3
- data/lib/facter/resolvers/freebsd/geom_resolver.rb +12 -20
- data/lib/facter/resolvers/freebsd/processors.rb +11 -7
- data/lib/facter/resolvers/mountpoints_resolver.rb +48 -23
- data/lib/facter/resolvers/partitions.rb +60 -57
- data/lib/facter/resolvers/solaris/dmi.rb +2 -0
- data/lib/facter/resolvers/solaris/networking.rb +0 -1
- data/lib/facter/resolvers/solaris/os_release.rb +4 -3
- data/lib/facter/resolvers/ssh_resolver.rb +4 -4
- data/lib/facter/version.rb +1 -1
- metadata +3 -4
- data/lib/facter/fact_groups.conf +0 -308
- data/lib/facter/os_hierarchy.json +0 -36
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 26e4084c96b8e155bea96be6eb69c241acf2974bf31d98ebc20a571f191e3083
|
4
|
+
data.tar.gz: 8cfb10254f2474b003c7d5f4739b455302546258b3dd0b65b1768df6e1a38b1e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 74e4755e3dedc6aedcba900d72577faa265f889b31b7ae60f6c85f0221f1e96f748c8b1342d9fc6ea7eafdf57dcacb675f3001465892b968f076c18432cfe9b7
|
7
|
+
data.tar.gz: cc030bcb93b65dddf47b5fdbbe39487a95f08794caf0f60985134c733f74a98ede9d0822c3647e9e0ab634eb9c336dd4a33a6f22d26ab8438f105787fbe74614
|
data/lib/facter.rb
CHANGED
@@ -20,7 +20,7 @@ module Facter
|
|
20
20
|
# Method used by puppet-agent to retrieve facts
|
21
21
|
# @param args_as_string [string] facter cli arguments
|
22
22
|
#
|
23
|
-
# @return
|
23
|
+
# @return query result
|
24
24
|
#
|
25
25
|
# @api private
|
26
26
|
def resolve(args_as_string)
|
@@ -42,7 +42,6 @@ module Facter
|
|
42
42
|
else
|
43
43
|
cli.invoke(:arg_parser)
|
44
44
|
end
|
45
|
-
nil
|
46
45
|
end
|
47
46
|
|
48
47
|
# Alias method for Facter.fact()
|
@@ -228,6 +227,18 @@ module Facter
|
|
228
227
|
nil
|
229
228
|
end
|
230
229
|
|
230
|
+
# Flushes cached values for all facts. This does not cause code to be
|
231
|
+
# reloaded; it only clears the cached results.
|
232
|
+
#
|
233
|
+
# @return [void]
|
234
|
+
#
|
235
|
+
# @api public
|
236
|
+
def flush
|
237
|
+
LegacyFacter.flush
|
238
|
+
SessionCache.invalidate_all_caches
|
239
|
+
nil
|
240
|
+
end
|
241
|
+
|
231
242
|
# Loads all facts
|
232
243
|
#
|
233
244
|
# @return [nil]
|
@@ -0,0 +1,354 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Facter
|
4
|
+
module Config
|
5
|
+
unless defined?(OS_HIERARCHY)
|
6
|
+
OS_HIERARCHY = [
|
7
|
+
{
|
8
|
+
'Linux' => [
|
9
|
+
{
|
10
|
+
'Debian' => %w[
|
11
|
+
Elementary
|
12
|
+
Ubuntu
|
13
|
+
Raspbian
|
14
|
+
]
|
15
|
+
},
|
16
|
+
{
|
17
|
+
'Rhel' => %w[
|
18
|
+
Fedora
|
19
|
+
Amzn
|
20
|
+
Centos
|
21
|
+
Ol
|
22
|
+
Scientific
|
23
|
+
]
|
24
|
+
},
|
25
|
+
{
|
26
|
+
'Sles' => [
|
27
|
+
'Opensuse'
|
28
|
+
]
|
29
|
+
}
|
30
|
+
]
|
31
|
+
},
|
32
|
+
{
|
33
|
+
'Bsd' => [
|
34
|
+
'Freebsd'
|
35
|
+
]
|
36
|
+
},
|
37
|
+
'Solaris',
|
38
|
+
'Macosx',
|
39
|
+
'Windows',
|
40
|
+
'Aix'
|
41
|
+
].freeze
|
42
|
+
end
|
43
|
+
unless defined? FACT_GROUPS
|
44
|
+
FACT_GROUPS = {
|
45
|
+
'EC2' => %w[
|
46
|
+
ec2_metadata
|
47
|
+
ec2_userdata
|
48
|
+
],
|
49
|
+
'GCE' => [
|
50
|
+
'gce'
|
51
|
+
],
|
52
|
+
'augeas' => %w[
|
53
|
+
augeas
|
54
|
+
augeasversion
|
55
|
+
],
|
56
|
+
'desktop management interface' => %w[
|
57
|
+
dmi
|
58
|
+
bios_vendor
|
59
|
+
bios_version
|
60
|
+
bios_release_date
|
61
|
+
boardassettag
|
62
|
+
boardmanufacturer
|
63
|
+
boardproductname
|
64
|
+
boardserialnumber
|
65
|
+
chassisassettag
|
66
|
+
manufacturer
|
67
|
+
productname
|
68
|
+
serialnumber
|
69
|
+
uuid
|
70
|
+
chassistype
|
71
|
+
],
|
72
|
+
'file system' => %w[
|
73
|
+
mountpoints
|
74
|
+
filesystems
|
75
|
+
partitions
|
76
|
+
],
|
77
|
+
'hypervisors' => [
|
78
|
+
'hypervisors'
|
79
|
+
],
|
80
|
+
'id' => %w[
|
81
|
+
id
|
82
|
+
gid
|
83
|
+
identity
|
84
|
+
],
|
85
|
+
'kernel' => %w[
|
86
|
+
kernel
|
87
|
+
kernelversion
|
88
|
+
kernelrelease
|
89
|
+
kernelmajversion
|
90
|
+
],
|
91
|
+
'load_average' => [
|
92
|
+
'load_averages'
|
93
|
+
],
|
94
|
+
'memory' => %w[
|
95
|
+
memory
|
96
|
+
memoryfree
|
97
|
+
memoryfree_mb
|
98
|
+
memorysize
|
99
|
+
memorysize_mb
|
100
|
+
swapfree
|
101
|
+
swapfree_mb
|
102
|
+
swapsize
|
103
|
+
swapsize_mb
|
104
|
+
swapencrypted
|
105
|
+
],
|
106
|
+
'networking' => %w[
|
107
|
+
networking
|
108
|
+
hostname
|
109
|
+
ipaddress
|
110
|
+
ipaddress6
|
111
|
+
netmask
|
112
|
+
netmask6
|
113
|
+
network
|
114
|
+
network6
|
115
|
+
macaddress
|
116
|
+
interfaces
|
117
|
+
domain
|
118
|
+
fqdn
|
119
|
+
dhcp_servers
|
120
|
+
],
|
121
|
+
'operating system' => %w[
|
122
|
+
os
|
123
|
+
operatingsystem
|
124
|
+
osfamily
|
125
|
+
operatingsystemrelease
|
126
|
+
operatingsystemmajrelease
|
127
|
+
hardwaremodel
|
128
|
+
architecture
|
129
|
+
lsbdistid
|
130
|
+
lsbdistrelease
|
131
|
+
lsbdistcodename
|
132
|
+
lsbdistdescription
|
133
|
+
lsbmajdistrelease
|
134
|
+
lsbminordistrelease
|
135
|
+
lsbrelease
|
136
|
+
macosx_buildversion
|
137
|
+
macosx_productname
|
138
|
+
macosx_productversion
|
139
|
+
macosx_productversion_major
|
140
|
+
macosx_productversion_minor
|
141
|
+
windows_edition_id
|
142
|
+
windows_installation_type
|
143
|
+
windows_product_name
|
144
|
+
windows_release_id
|
145
|
+
system32
|
146
|
+
selinux
|
147
|
+
selinux_enforced
|
148
|
+
selinux_policyversion
|
149
|
+
selinux_current_mode
|
150
|
+
selinux_config_mode
|
151
|
+
selinux_config_policy
|
152
|
+
],
|
153
|
+
'path' => [
|
154
|
+
'path'
|
155
|
+
],
|
156
|
+
'processor' => %w[
|
157
|
+
processors
|
158
|
+
processorcount
|
159
|
+
physicalprocessorcount
|
160
|
+
hardwareisa
|
161
|
+
],
|
162
|
+
'ssh' => %w[
|
163
|
+
ssh
|
164
|
+
sshdsakey
|
165
|
+
sshrsakey
|
166
|
+
sshecdsakey
|
167
|
+
sshed25519key
|
168
|
+
sshfp_dsa
|
169
|
+
sshfp_rsa
|
170
|
+
sshfp_ecdsa
|
171
|
+
sshfp_ed25519
|
172
|
+
],
|
173
|
+
'system profiler' => %w[
|
174
|
+
system_profiler
|
175
|
+
sp_boot_mode
|
176
|
+
sp_boot_rom_version
|
177
|
+
sp_boot_volume
|
178
|
+
sp_cpu_type
|
179
|
+
sp_current_processor_speed
|
180
|
+
sp_kernel_version
|
181
|
+
sp_l2_cache_core
|
182
|
+
sp_l3_cache
|
183
|
+
sp_local_host_name
|
184
|
+
sp_machine_model
|
185
|
+
sp_machine_name
|
186
|
+
sp_number_processors
|
187
|
+
sp_os_version
|
188
|
+
sp_packages
|
189
|
+
sp_physical_memory
|
190
|
+
sp_platform_uuid
|
191
|
+
sp_secure_vm
|
192
|
+
sp_serial_number
|
193
|
+
sp_smc_version_system
|
194
|
+
sp_uptime
|
195
|
+
sp_user_name
|
196
|
+
],
|
197
|
+
'timezone' => [
|
198
|
+
'timezone'
|
199
|
+
],
|
200
|
+
'uptime' => %w[
|
201
|
+
system_uptime
|
202
|
+
uptime
|
203
|
+
uptime_days
|
204
|
+
uptime_hours
|
205
|
+
uptime_seconds
|
206
|
+
],
|
207
|
+
'virtualization' => %w[
|
208
|
+
virtual
|
209
|
+
is_virtual
|
210
|
+
cloud
|
211
|
+
],
|
212
|
+
'legacy' => [
|
213
|
+
'architecture',
|
214
|
+
'augeasversion',
|
215
|
+
'bios_release_date',
|
216
|
+
'bios_vendor',
|
217
|
+
'bios_version',
|
218
|
+
'blockdevice_*_model',
|
219
|
+
'blockdevice_*_size',
|
220
|
+
'blockdevice_*_vendor',
|
221
|
+
'blockdevices',
|
222
|
+
'boardassettag',
|
223
|
+
'boardmanufacturer',
|
224
|
+
'boardproductname',
|
225
|
+
'boardserialnumber',
|
226
|
+
'chassisassettag',
|
227
|
+
'chassistype',
|
228
|
+
'dhcp_servers',
|
229
|
+
'domain',
|
230
|
+
'fqdn',
|
231
|
+
'gid',
|
232
|
+
'hardwareisa',
|
233
|
+
'hardwaremodel',
|
234
|
+
'hostname',
|
235
|
+
'id',
|
236
|
+
'interfaces',
|
237
|
+
'ipaddress',
|
238
|
+
'ipaddress_.*',
|
239
|
+
'ipaddress_*',
|
240
|
+
'ipaddress6',
|
241
|
+
'ipaddress6_.*',
|
242
|
+
'ipaddress6_*',
|
243
|
+
'ldom_*',
|
244
|
+
'lsbdistcodename',
|
245
|
+
'lsbdistdescription',
|
246
|
+
'lsbdistid',
|
247
|
+
'lsbdistrelease',
|
248
|
+
'lsbmajdistrelease',
|
249
|
+
'lsbminordistrelease',
|
250
|
+
'lsbrelease',
|
251
|
+
'macaddress',
|
252
|
+
'macaddress_.*',
|
253
|
+
'macaddress_*',
|
254
|
+
'macosx_buildversion',
|
255
|
+
'macosx_productname',
|
256
|
+
'macosx_productversion',
|
257
|
+
'macosx_productversion_major',
|
258
|
+
'macosx_productversion_minor',
|
259
|
+
'manufacturer',
|
260
|
+
'memoryfree',
|
261
|
+
'memoryfree_mb',
|
262
|
+
'memorysize',
|
263
|
+
'memorysize_mb',
|
264
|
+
'mtu_.*',
|
265
|
+
'mtu_*',
|
266
|
+
'netmask',
|
267
|
+
'netmask_.*',
|
268
|
+
'netmask_*',
|
269
|
+
'netmask6',
|
270
|
+
'netmask6_.*',
|
271
|
+
'netmask6_*',
|
272
|
+
'network',
|
273
|
+
'network_.*',
|
274
|
+
'network_*',
|
275
|
+
'network6',
|
276
|
+
'network6_.*',
|
277
|
+
'network6_*',
|
278
|
+
'operatingsystem',
|
279
|
+
'operatingsystemmajrelease',
|
280
|
+
'operatingsystemrelease',
|
281
|
+
'osfamily',
|
282
|
+
'physicalprocessorcount',
|
283
|
+
'processor.*',
|
284
|
+
'processor*',
|
285
|
+
'processorcount',
|
286
|
+
'productname',
|
287
|
+
'rubyplatform',
|
288
|
+
'rubysitedir',
|
289
|
+
'rubyversion',
|
290
|
+
'scope6',
|
291
|
+
'scope6_.*',
|
292
|
+
'selinux',
|
293
|
+
'selinux_config_mode',
|
294
|
+
'selinux_config_policy',
|
295
|
+
'selinux_current_mode',
|
296
|
+
'selinux_enforced',
|
297
|
+
'selinux_policyversion',
|
298
|
+
'serialnumber',
|
299
|
+
'sp_*',
|
300
|
+
'sp_boot_mode',
|
301
|
+
'sp_boot_rom_version',
|
302
|
+
'sp_boot_volume',
|
303
|
+
'sp_cpu_type',
|
304
|
+
'sp_current_processor_speed',
|
305
|
+
'sp_kernel_version',
|
306
|
+
'sp_l2_cache_core',
|
307
|
+
'sp_l3_cache',
|
308
|
+
'sp_local_host_name',
|
309
|
+
'sp_machine_model',
|
310
|
+
'sp_machine_name',
|
311
|
+
'sp_number_processors',
|
312
|
+
'sp_os_version',
|
313
|
+
'sp_packages',
|
314
|
+
'sp_physical_memory',
|
315
|
+
'sp_platform_uuid',
|
316
|
+
'sp_secure_vm',
|
317
|
+
'sp_serial_number',
|
318
|
+
'sp_smc_version_system',
|
319
|
+
'sp_uptime',
|
320
|
+
'sp_user_name',
|
321
|
+
'ssh.*key',
|
322
|
+
'ssh*key',
|
323
|
+
'sshfp_.*',
|
324
|
+
'sshfp_*',
|
325
|
+
'swapencrypted',
|
326
|
+
'swapfree',
|
327
|
+
'swapfree_mb',
|
328
|
+
'swapsize',
|
329
|
+
'swapsize_mb',
|
330
|
+
'system32',
|
331
|
+
'uptime',
|
332
|
+
'uptime_days',
|
333
|
+
'uptime_hours',
|
334
|
+
'uptime_seconds',
|
335
|
+
'uuid',
|
336
|
+
'windows_edition_id',
|
337
|
+
'windows_installation_type',
|
338
|
+
'windows_product_name',
|
339
|
+
'windows_release_id',
|
340
|
+
'xendomains',
|
341
|
+
'zone_*_brand',
|
342
|
+
'zone_*_id',
|
343
|
+
'zone_*_iptype',
|
344
|
+
'zone_*_name',
|
345
|
+
'zone_*_path',
|
346
|
+
'zone_*_status',
|
347
|
+
'zone_*_uuid',
|
348
|
+
'zonename',
|
349
|
+
'zones'
|
350
|
+
]
|
351
|
+
}.freeze
|
352
|
+
end
|
353
|
+
end
|
354
|
+
end
|
@@ -155,7 +155,7 @@ module Facter
|
|
155
155
|
@searching
|
156
156
|
end
|
157
157
|
|
158
|
-
# Lock our searching process, so we never
|
158
|
+
# Lock our searching process, so we never get stuck in recursion.
|
159
159
|
def searching
|
160
160
|
raise "Caught recursion on #{@name}" if searching?
|
161
161
|
|
@@ -7,11 +7,13 @@ module Facter
|
|
7
7
|
module Benchmarking
|
8
8
|
class Timer
|
9
9
|
class << self
|
10
|
-
def measure(fact_name)
|
10
|
+
def measure(fact_name, prefix_message = '')
|
11
11
|
if Options[:timing]
|
12
12
|
time = Benchmark.measure { yield }
|
13
13
|
|
14
|
-
|
14
|
+
log = "fact '#{fact_name}', took: #{time.format('%r')} seconds"
|
15
|
+
prefix_message = "#{prefix_message} " unless prefix_message.empty?
|
16
|
+
puts "#{prefix_message}#{log}"
|
15
17
|
else
|
16
18
|
yield
|
17
19
|
end
|
@@ -1,5 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'facter/config'
|
4
|
+
|
3
5
|
module Facter
|
4
6
|
class FactGroups
|
5
7
|
attr_reader :groups, :block_list, :facts_ttls
|
@@ -8,10 +10,8 @@ module Facter
|
|
8
10
|
|
9
11
|
STRING_TO_SECONDS = { 'seconds' => 1, 'minutes' => 60, 'hours' => 3600, 'days' => 3600 * 24 }.freeze
|
10
12
|
|
11
|
-
def initialize
|
12
|
-
|
13
|
-
@groups_file_path = group_list_path || default_path
|
14
|
-
@groups ||= File.readable?(@groups_file_path) ? Hocon.load(@groups_file_path) : {}
|
13
|
+
def initialize
|
14
|
+
@groups = Facter::Config::FACT_GROUPS.dup
|
15
15
|
load_groups
|
16
16
|
load_groups_from_options
|
17
17
|
load_facts_ttls
|
@@ -91,7 +91,7 @@ module Facter
|
|
91
91
|
|
92
92
|
def load_groups
|
93
93
|
config = ConfigReader.init(Options[:config])
|
94
|
-
@block_list = config.block_list ||
|
94
|
+
@block_list = config.block_list || []
|
95
95
|
@groups_ttls = config.ttls || []
|
96
96
|
@groups.merge!(config.fact_groups) if config.fact_groups
|
97
97
|
end
|