facter 4.0.35 → 4.0.36

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) hide show
  1. checksums.yaml +4 -4
  2. data/lib/facter/custom_facts/util/directory_loader.rb +3 -1
  3. data/lib/facter/fact_groups.conf +140 -1
  4. data/lib/facter/facts/aix/disks.rb +17 -2
  5. data/lib/facter/facts/aix/networking/scope6.rb +3 -1
  6. data/lib/facter/facts/aix/scope6_interfaces.rb +0 -2
  7. data/lib/facter/facts/aix/serialnumber.rb +20 -0
  8. data/lib/facter/facts/aix/sshalgorithmkey.rb +17 -0
  9. data/lib/facter/facts/aix/sshfp_algorithm.rb +20 -0
  10. data/lib/facter/facts/debian/os/distro/release.rb +6 -1
  11. data/lib/facter/facts/freebsd/sshalgorithmkey.rb +17 -0
  12. data/lib/facter/facts/freebsd/sshfp_algorithm.rb +20 -0
  13. data/lib/facter/facts/linux/disks.rb +20 -1
  14. data/lib/facter/facts/linux/dmi/board/asset_tag.rb +19 -0
  15. data/lib/facter/facts/linux/ec2_metadata.rb +5 -3
  16. data/lib/facter/facts/linux/ec2_userdata.rb +5 -3
  17. data/lib/facter/facts/linux/gce.rb +16 -0
  18. data/lib/facter/facts/linux/is_virtual.rb +1 -3
  19. data/lib/facter/facts/linux/networking/scope6.rb +3 -1
  20. data/lib/facter/facts/linux/processors/speed.rb +17 -0
  21. data/lib/facter/facts/linux/scope6_interfaces.rb +1 -2
  22. data/lib/facter/facts/linux/sshfp_algorithm.rb +1 -1
  23. data/lib/facter/facts/linux/xen.rb +28 -0
  24. data/lib/facter/facts/macosx/networking/scope6.rb +3 -1
  25. data/lib/facter/facts/macosx/scope6_interfaces.rb +0 -2
  26. data/lib/facter/facts/macosx/sshfp_algorithm.rb +1 -1
  27. data/lib/facter/facts/solaris/disks.rb +21 -2
  28. data/lib/facter/facts/solaris/hypervisors/ldom.rb +24 -0
  29. data/lib/facter/facts/solaris/hypervisors/zone.rb +39 -0
  30. data/lib/facter/facts/solaris/is_virtual.rb +64 -0
  31. data/lib/facter/facts/solaris/kernelmajversion.rb +1 -1
  32. data/lib/facter/facts/solaris/ldom.rb +35 -0
  33. data/lib/facter/facts/solaris/sshalgorithmkey.rb +17 -0
  34. data/lib/facter/facts/solaris/sshfp_algorithm.rb +20 -0
  35. data/lib/facter/facts/solaris/virtual.rb +60 -0
  36. data/lib/facter/facts/solaris/zones.rb +1 -1
  37. data/lib/facter/facts/windows/ec2_metadata.rb +5 -3
  38. data/lib/facter/facts/windows/ec2_userdata.rb +5 -3
  39. data/lib/facter/facts/windows/gce.rb +16 -0
  40. data/lib/facter/facts/windows/networking/scope6.rb +3 -1
  41. data/lib/facter/facts/windows/sshalgorithmkey.rb +22 -0
  42. data/lib/facter/facts/windows/sshfp_algorithm.rb +25 -0
  43. data/lib/facter/facts_utils/facts_utils.rb +2 -0
  44. data/lib/facter/framework/core/fact/internal/core_fact.rb +2 -0
  45. data/lib/facter/framework/core/fact/internal/internal_fact_manager.rb +10 -25
  46. data/lib/facter/framework/core/fact_filter.rb +13 -0
  47. data/lib/facter/framework/core/fact_loaders/fact_loader.rb +24 -1
  48. data/lib/facter/framework/formatters/legacy_fact_formatter.rb +8 -1
  49. data/lib/facter/framework/formatters/yaml_fact_formatter.rb +1 -1
  50. data/lib/facter/resolvers/aix/serialnumber.rb +37 -0
  51. data/lib/facter/resolvers/dmi_resolver.rb +4 -3
  52. data/lib/facter/resolvers/ec2.rb +4 -18
  53. data/lib/facter/resolvers/gce.rb +54 -0
  54. data/lib/facter/resolvers/memory_resolver.rb +8 -1
  55. data/lib/facter/resolvers/processors_resolver.rb +24 -2
  56. data/lib/facter/resolvers/solaris/ldom.rb +70 -0
  57. data/lib/facter/resolvers/utils/http.rb +68 -0
  58. data/lib/facter/resolvers/xen.rb +28 -0
  59. data/lib/facter/version.rb +1 -1
  60. metadata +25 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 310bcaf0123dcbfdc035568dd69e5701204fdd47286c4f1a57cc2cec1bb310f2
4
- data.tar.gz: 1165a5771b7da00ba62b0869b3c951a475466cf99d959090e7ff168565076134
3
+ metadata.gz: ceb625b0a349be8f5f574055b24aebd9860672ccdfc27224377a75255681b571
4
+ data.tar.gz: 1081225dee1a50781041d65599bc74fccf1552fe1ce75a9195f0aecd8608afb8
5
5
  SHA512:
6
- metadata.gz: e3a8f6a079db9d1ab380205953ea1f325ab4274de480ba49ef4e1d162e6ff3058ee78ac89ef845fb19949806d53d857cc0f8f9ff651d346ff71179a5fd6b682d
7
- data.tar.gz: 0270a90dd9010adc24a61cb00c31b4ebade6847a2d8697d56bef09ea8e66ce6417e7298885bf3c8cd36ccc90917c5ba7e25c0efe81e795b8fd5df90d43c5d308
6
+ metadata.gz: 0c31f37ed2064c1683e9f56a5d252bab225e1af0c0df025d1621ef89551fefa6a0816cc3862d4c98ab2480a6e158f62b18bcf0d5ae9f2d75f22799297660ffc9
7
+ data.tar.gz: d6f071e0bf9bcdf01c460ea7ac45d0cb50459c4a40e663761cf7c58de0068b6c9e444cebedd5304a692317a960a8d1327accea35f6815b90076e4acc4ce2ec3b
@@ -35,6 +35,7 @@ module LegacyFacter
35
35
  def initialize(dir = LegacyFacter::Util::Config.external_facts_dirs, weight = EXTERNAL_FACT_WEIGHT)
36
36
  @directories = [dir].flatten
37
37
  @weight = weight
38
+ @log ||= Facter::Log.new(self)
38
39
  end
39
40
 
40
41
  # Load facts from files in fact directory using the relevant parser classes to
@@ -84,10 +85,11 @@ module LegacyFacter
84
85
  next if parser.nil?
85
86
 
86
87
  data = parser.results
88
+
87
89
  if data == false
88
90
  LegacyFacter.warn "Could not interpret fact file #{fact.file}"
89
91
  elsif (data == {}) || data.nil?
90
- LegacyFacter.warn "Fact file #{fact.file} was parsed but returned an empty data set"
92
+ @log.debug("Fact file #{fact.file} was parsed but no key=>value data was returned")
91
93
  else
92
94
  data.each do |p, v|
93
95
  collection.add(p, value: v, fact_type: :external,
@@ -165,5 +165,144 @@
165
165
  "virtual",
166
166
  "is_virtual",
167
167
  "cloud"
168
+ ],
169
+ "legacy": [
170
+ "architecture",
171
+ "augeasversion",
172
+ "bios_release_date",
173
+ "bios_vendor",
174
+ "bios_version",
175
+ "blockdevice_*_model",
176
+ "blockdevice_*_size",
177
+ "blockdevice_*_vendor",
178
+ "blockdevices",
179
+ "boardassettag",
180
+ "boardmanufacturer",
181
+ "boardproductname",
182
+ "boardserialnumber",
183
+ "chassisassettag",
184
+ "chassistype",
185
+ "dhcp_servers",
186
+ "domain",
187
+ "fqdn",
188
+ "gid",
189
+ "hardwareisa",
190
+ "hardwaremodel",
191
+ "hostname",
192
+ "id",
193
+ "interfaces",
194
+ "ipaddress",
195
+ "ipaddress_.*",
196
+ "ipaddress_*",
197
+ "ipaddress6",
198
+ "ipaddress6_.*",
199
+ "ipaddress6_*",
200
+ "ldom_*",
201
+ "lsbdistcodename",
202
+ "lsbdistdescription",
203
+ "lsbdistid",
204
+ "lsbdistrelease",
205
+ "lsbmajdistrelease",
206
+ "lsbminordistrelease",
207
+ "lsbrelease",
208
+ "macaddress",
209
+ "macaddress_.*",
210
+ "macaddress_*",
211
+ "macosx_buildversion",
212
+ "macosx_productname",
213
+ "macosx_productversion",
214
+ "macosx_productversion_major",
215
+ "macosx_productversion_minor",
216
+ "manufacturer",
217
+ "memoryfree",
218
+ "memoryfree_mb",
219
+ "memorysize",
220
+ "memorysize_mb",
221
+ "mtu_.*",
222
+ "mtu_*",
223
+ "netmask",
224
+ "netmask_.*",
225
+ "netmask_*",
226
+ "netmask6",
227
+ "netmask6_.*",
228
+ "netmask6_*",
229
+ "network",
230
+ "network_.*",
231
+ "network_*",
232
+ "network6",
233
+ "network6_.*",
234
+ "network6_*",
235
+ "operatingsystem",
236
+ "operatingsystemmajrelease",
237
+ "operatingsystemrelease",
238
+ "osfamily",
239
+ "physicalprocessorcount",
240
+ "processor.*",
241
+ "processor*",
242
+ "processorcount",
243
+ "productname",
244
+ "rubyplatform",
245
+ "rubysitedir",
246
+ "rubyversion",
247
+ "scope6",
248
+ "scope6_.*",
249
+ "selinux",
250
+ "selinux_config_mode",
251
+ "selinux_config_policy",
252
+ "selinux_current_mode",
253
+ "selinux_enforced",
254
+ "selinux_policyversion",
255
+ "serialnumber",
256
+ "sp_*",
257
+ "sp_boot_mode",
258
+ "sp_boot_rom_version",
259
+ "sp_boot_volume",
260
+ "sp_cpu_type",
261
+ "sp_current_processor_speed",
262
+ "sp_kernel_version",
263
+ "sp_l2_cache_core",
264
+ "sp_l3_cache",
265
+ "sp_local_host_name",
266
+ "sp_machine_model",
267
+ "sp_machine_name",
268
+ "sp_number_processors",
269
+ "sp_os_version",
270
+ "sp_packages",
271
+ "sp_physical_memory",
272
+ "sp_platform_uuid",
273
+ "sp_secure_vm",
274
+ "sp_serial_number",
275
+ "sp_smc_version_system",
276
+ "sp_uptime",
277
+ "sp_user_name",
278
+ "ssh.*key",
279
+ "ssh*key",
280
+ "sshfp_.*",
281
+ "sshfp_*",
282
+ "swapencrypted",
283
+ "swapfree",
284
+ "swapfree_mb",
285
+ "swapsize",
286
+ "swapsize_mb",
287
+ "system32",
288
+ "uptime",
289
+ "uptime_days",
290
+ "uptime_hours",
291
+ "uptime_seconds",
292
+ "uuid",
293
+ "windows_edition_id",
294
+ "windows_installation_type",
295
+ "windows_product_name",
296
+ "windows_release_id",
297
+ "xendomains",
298
+ "zone_*_brand",
299
+ "zone_*_id",
300
+ "zone_*_iptype",
301
+ "zone_*_name",
302
+ "zone_*_path",
303
+ "zone_*_status",
304
+ "zone_*_uuid",
305
+ "zonename",
306
+ "zones"
168
307
  ]
169
- }
308
+ }
@@ -4,13 +4,28 @@ module Facts
4
4
  module Aix
5
5
  class Disks
6
6
  FACT_NAME = 'disks'
7
+ ALIASES = %w[blockdevices blockdevice_.*_size'].freeze
7
8
 
8
9
  def call_the_resolver
10
+ facts = []
9
11
  disks = Facter::Resolvers::Aix::Disks.resolve(:disks)
10
12
 
11
- disks = disks&.empty? ? nil : disks
13
+ return Facter::ResolvedFact.new(FACT_NAME, nil) if disks.nil? || disks.empty?
12
14
 
13
- Facter::ResolvedFact.new(FACT_NAME, disks)
15
+ blockdevices = disks.keys.join(',')
16
+ facts.push(Facter::ResolvedFact.new(FACT_NAME, disks))
17
+ facts.push(Facter::ResolvedFact.new('blockdevices', blockdevices, :legacy))
18
+ add_legacy_facts(disks, facts)
19
+
20
+ facts
21
+ end
22
+
23
+ private
24
+
25
+ def add_legacy_facts(disks, facts)
26
+ disks.each do |disk_name, disk_info|
27
+ facts.push(Facter::ResolvedFact.new("blockdevice_#{disk_name}_size", disk_info[:size_bytes].to_s, :legacy))
28
+ end
14
29
  end
15
30
  end
16
31
  end
@@ -5,11 +5,13 @@ module Facts
5
5
  module Networking
6
6
  class Scope6
7
7
  FACT_NAME = 'networking.scope6'
8
+ ALIASES = 'scope6'
8
9
 
9
10
  def call_the_resolver
10
11
  fact_value = Facter::Resolvers::Aix::Networking.resolve(:scope6)
11
12
 
12
- Facter::ResolvedFact.new(FACT_NAME, fact_value)
13
+ [Facter::ResolvedFact.new(FACT_NAME, fact_value),
14
+ Facter::ResolvedFact.new('scope6', fact_value, :legacy)]
13
15
  end
14
16
  end
15
17
  end
@@ -9,7 +9,6 @@ module Facts
9
9
  def call_the_resolver
10
10
  resolved_facts = []
11
11
  interfaces = Facter::Resolvers::Aix::Networking.resolve(:interfaces)
12
- scope6 = Facter::Resolvers::Aix::Networking.resolve(:scope6)
13
12
 
14
13
  interfaces&.each do |interface_name, info|
15
14
  if info[:scope6]
@@ -17,7 +16,6 @@ module Facts
17
16
  end
18
17
  end
19
18
 
20
- resolved_facts << Facter::ResolvedFact.new('scope6', scope6, :legacy) if scope6
21
19
  resolved_facts
22
20
  end
23
21
  end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Facts
4
+ module Aix
5
+ class Serialnumber
6
+ FACT_NAME = 'serialnumber'
7
+ TYPE = :legacy
8
+
9
+ def call_the_resolver
10
+ Facter::ResolvedFact.new(FACT_NAME, fact_value, :legacy)
11
+ end
12
+
13
+ private
14
+
15
+ def fact_value
16
+ Facter::Resolvers::Aix::Serialnumber.resolve(:serialnumber)
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Facts
4
+ module Aix
5
+ class Sshalgorithmkey
6
+ FACT_NAME = 'ssh.*key'
7
+ TYPE = :legacy
8
+
9
+ def call_the_resolver
10
+ facts = []
11
+ result = Facter::Resolvers::SshResolver.resolve(:ssh)
12
+ result.each { |ssh| facts << Facter::ResolvedFact.new("ssh#{ssh.name.to_sym}key", ssh.key, :legacy) }
13
+ facts
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Facts
4
+ module Aix
5
+ class SshfpAlgorithm
6
+ FACT_NAME = 'sshfp_.*'
7
+ TYPE = :legacy
8
+
9
+ def call_the_resolver
10
+ facts = []
11
+ result = Facter::Resolvers::SshResolver.resolve(:ssh)
12
+ result.each do |ssh|
13
+ facts << Facter::ResolvedFact.new("sshfp_#{ssh.name.to_sym}",
14
+ "#{ssh.fingerprint.sha1}\n#{ssh.fingerprint.sha256}", :legacy)
15
+ end
16
+ facts
17
+ end
18
+ end
19
+ end
20
+ end
@@ -6,11 +6,16 @@ module Facts
6
6
  module Distro
7
7
  class Release
8
8
  FACT_NAME = 'os.distro.release'
9
+ ALIASES = %w[lsbdistrelease lsbmajdistrelease lsbminordistrelease].freeze
9
10
 
10
11
  def call_the_resolver
11
12
  fact_value = determine_release_for_os
13
+ return Facter::ResolvedFact.new(FACT_NAME, nil) unless fact_value
12
14
 
13
- Facter::ResolvedFact.new(FACT_NAME, fact_value)
15
+ [Facter::ResolvedFact.new(FACT_NAME, fact_value),
16
+ Facter::ResolvedFact.new(ALIASES[0], fact_value['full'], :legacy),
17
+ Facter::ResolvedFact.new(ALIASES[1], fact_value['major'], :legacy),
18
+ Facter::ResolvedFact.new(ALIASES[2], fact_value['minor'], :legacy)]
14
19
  end
15
20
 
16
21
  private
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Facts
4
+ module Freebsd
5
+ class Sshalgorithmkey
6
+ FACT_NAME = 'ssh.*key'
7
+ TYPE = :legacy
8
+
9
+ def call_the_resolver
10
+ facts = []
11
+ result = Facter::Resolvers::SshResolver.resolve(:ssh)
12
+ result.each { |ssh| facts << Facter::ResolvedFact.new("ssh#{ssh.name.to_sym}key", ssh.key, :legacy) }
13
+ facts
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Facts
4
+ module Freebsd
5
+ class SshfpAlgorithm
6
+ FACT_NAME = 'sshfp_.*'
7
+ TYPE = :legacy
8
+
9
+ def call_the_resolver
10
+ facts = []
11
+ result = Facter::Resolvers::SshResolver.resolve(:ssh)
12
+ result.each do |ssh|
13
+ facts << Facter::ResolvedFact.new("sshfp_#{ssh.name.to_sym}",
14
+ "#{ssh.fingerprint.sha1}\n#{ssh.fingerprint.sha256}", :legacy)
15
+ end
16
+ facts
17
+ end
18
+ end
19
+ end
20
+ end
@@ -4,11 +4,30 @@ module Facts
4
4
  module Linux
5
5
  class Disks
6
6
  FACT_NAME = 'disks'
7
+ ALIASES = %w[blockdevices blockdevice_.*_model blockdevice_.*_size blockdevice_.*_vendor'].freeze
7
8
 
8
9
  def call_the_resolver
10
+ facts = []
9
11
  disks = Facter::Resolvers::Linux::Disk.resolve(:disks)
10
12
 
11
- Facter::ResolvedFact.new(FACT_NAME, disks)
13
+ return Facter::ResolvedFact.new(FACT_NAME, nil) if disks.nil? || disks.empty?
14
+
15
+ blockdevices = disks.keys.join(',')
16
+ facts.push(Facter::ResolvedFact.new(FACT_NAME, disks))
17
+ facts.push(Facter::ResolvedFact.new('blockdevices', blockdevices, :legacy))
18
+ add_legacy_facts(disks, facts)
19
+
20
+ facts
21
+ end
22
+
23
+ private
24
+
25
+ def add_legacy_facts(disks, facts)
26
+ disks.each do |disk_name, disk_info|
27
+ facts.push(Facter::ResolvedFact.new("blockdevice_#{disk_name}_model", disk_info[:model], :legacy))
28
+ facts.push(Facter::ResolvedFact.new("blockdevice_#{disk_name}_size", disk_info[:size_bytes].to_s, :legacy))
29
+ facts.push(Facter::ResolvedFact.new("blockdevice_#{disk_name}_vendor", disk_info[:vendor], :legacy))
30
+ end
12
31
  end
13
32
  end
14
33
  end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Facts
4
+ module Linux
5
+ module Dmi
6
+ module Board
7
+ class AssetTag
8
+ FACT_NAME = 'dmi.board.asset_tag'
9
+ ALIASES = 'boardassettag'
10
+
11
+ def call_the_resolver
12
+ fact_value = Facter::Resolvers::Linux::DmiBios.resolve(:board_asset_tag)
13
+ [Facter::ResolvedFact.new(FACT_NAME, fact_value), Facter::ResolvedFact.new(ALIASES, fact_value, :legacy)]
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -6,14 +6,16 @@ module Facts
6
6
  FACT_NAME = 'ec2_metadata'
7
7
 
8
8
  def call_the_resolver
9
- return Facter::ResolvedFact.new(FACT_NAME, nil) unless aws?
9
+ return Facter::ResolvedFact.new(FACT_NAME, nil) unless aws_hypervisors?
10
10
 
11
11
  fact_value = Facter::Resolvers::Ec2.resolve(:metadata)
12
12
 
13
- Facter::ResolvedFact.new(FACT_NAME, fact_value.empty? ? nil : fact_value)
13
+ Facter::ResolvedFact.new(FACT_NAME, fact_value&.empty? ? nil : fact_value)
14
14
  end
15
15
 
16
- def aws?
16
+ private
17
+
18
+ def aws_hypervisors?
17
19
  virtual = check_virt_what || check_xen || check_product_name || check_bios_vendor || check_lspci
18
20
 
19
21
  virtual == 'kvm' || virtual =~ /xen/
@@ -6,14 +6,16 @@ module Facts
6
6
  FACT_NAME = 'ec2_userdata'
7
7
 
8
8
  def call_the_resolver
9
- return Facter::ResolvedFact.new(FACT_NAME, nil) unless aws?
9
+ return Facter::ResolvedFact.new(FACT_NAME, nil) unless aws_hypervisors?
10
10
 
11
11
  fact_value = Facter::Resolvers::Ec2.resolve(:userdata)
12
12
 
13
- Facter::ResolvedFact.new(FACT_NAME, fact_value.empty? ? nil : fact_value)
13
+ Facter::ResolvedFact.new(FACT_NAME, fact_value&.empty? ? nil : fact_value)
14
14
  end
15
15
 
16
- def aws?
16
+ private
17
+
18
+ def aws_hypervisors?
17
19
  virtual = check_virt_what || check_xen || check_product_name || check_bios_vendor || check_lspci
18
20
 
19
21
  virtual == 'kvm' || virtual =~ /xen/