facter 4.0.36 → 4.0.37

Sign up to get free protection for your applications and to get access to all the features.
Files changed (119) hide show
  1. checksums.yaml +4 -4
  2. data/lib/facter/custom_facts/util/directory_loader.rb +9 -1
  3. data/lib/facter/custom_facts/util/fact.rb +4 -1
  4. data/lib/facter/facts/linux/partitions.rb +1 -1
  5. data/lib/facter/facts/ubuntu/lsbdistrelease.rb +23 -0
  6. data/lib/facter/framework/benchmarking/timer.rb +23 -0
  7. data/lib/facter/framework/cli/cli.rb +5 -0
  8. data/lib/facter/framework/core/fact/internal/internal_fact_manager.rb +2 -1
  9. data/lib/facter/framework/core/fact_loaders/internal_fact_loader.rb +7 -7
  10. data/lib/facter/framework/core/file_loader.rb +2 -0
  11. data/lib/facter/framework/core/options/option_store.rb +3 -1
  12. data/lib/facter/framework/core/session_cache.rb +1 -4
  13. data/lib/facter/resolvers/aio_agent_version.rb +0 -1
  14. data/lib/facter/resolvers/aix/architecture_resolver.rb +0 -1
  15. data/lib/facter/resolvers/aix/disks.rb +2 -3
  16. data/lib/facter/resolvers/aix/filesystem_resolver.rb +0 -1
  17. data/lib/facter/resolvers/aix/hardware_resolver.rb +0 -1
  18. data/lib/facter/resolvers/aix/load_averages_resolver.rb +0 -1
  19. data/lib/facter/resolvers/aix/memory.rb +2 -3
  20. data/lib/facter/resolvers/aix/mountpoints.rb +0 -1
  21. data/lib/facter/resolvers/aix/networking_resolver.rb +0 -1
  22. data/lib/facter/resolvers/aix/nim.rb +0 -1
  23. data/lib/facter/resolvers/aix/os_level_resolver.rb +0 -1
  24. data/lib/facter/resolvers/aix/partitions.rb +2 -3
  25. data/lib/facter/resolvers/aix/processors.rb +0 -1
  26. data/lib/facter/resolvers/aix/serialnumber.rb +0 -1
  27. data/lib/facter/resolvers/augeas_resolver.rb +0 -1
  28. data/lib/facter/resolvers/base_resolver.rb +9 -4
  29. data/lib/facter/resolvers/bsd/processors.rb +0 -1
  30. data/lib/facter/resolvers/containers.rb +0 -1
  31. data/lib/facter/resolvers/debian_version.rb +0 -1
  32. data/lib/facter/resolvers/disk_resolver.rb +0 -1
  33. data/lib/facter/resolvers/dmi_decode.rb +0 -1
  34. data/lib/facter/resolvers/dmi_resolver.rb +0 -1
  35. data/lib/facter/resolvers/ec2.rb +0 -1
  36. data/lib/facter/resolvers/eos_release_resolver.rb +0 -1
  37. data/lib/facter/resolvers/facterversion_resolver.rb +0 -1
  38. data/lib/facter/resolvers/filesystems_resolver.rb +0 -1
  39. data/lib/facter/resolvers/fips_enabled_resolver.rb +0 -1
  40. data/lib/facter/resolvers/freebsd/dmi_resolver.rb +0 -1
  41. data/lib/facter/resolvers/freebsd/freebsd_version_resolver.rb +0 -1
  42. data/lib/facter/resolvers/freebsd/geom_resolver.rb +0 -1
  43. data/lib/facter/resolvers/freebsd/processors.rb +0 -1
  44. data/lib/facter/resolvers/freebsd/swap_memory_resolver.rb +0 -1
  45. data/lib/facter/resolvers/freebsd/system_memory_resolver.rb +0 -1
  46. data/lib/facter/resolvers/gce.rb +0 -1
  47. data/lib/facter/resolvers/hostname_resolver.rb +0 -1
  48. data/lib/facter/resolvers/identity_resolver.rb +0 -1
  49. data/lib/facter/resolvers/linux/docker_uptime.rb +0 -1
  50. data/lib/facter/resolvers/linux/load_averages.rb +0 -1
  51. data/lib/facter/resolvers/load_averages.rb +0 -1
  52. data/lib/facter/resolvers/lpar_resolver.rb +0 -1
  53. data/lib/facter/resolvers/lsb_release_resolver.rb +0 -1
  54. data/lib/facter/resolvers/lspci.rb +0 -1
  55. data/lib/facter/resolvers/macosx/dmi_resolver.rb +0 -1
  56. data/lib/facter/resolvers/macosx/filesystems_resolver.rb +1 -6
  57. data/lib/facter/resolvers/macosx/load_averages_resolver.rb +0 -1
  58. data/lib/facter/resolvers/macosx/mountpoints_resolver.rb +3 -3
  59. data/lib/facter/resolvers/macosx/processor_resolver.rb +0 -1
  60. data/lib/facter/resolvers/macosx/swap_memory_resolver.rb +0 -1
  61. data/lib/facter/resolvers/macosx/system_memory_resolver.rb +0 -1
  62. data/lib/facter/resolvers/macosx/system_profiler_resolver.rb +0 -1
  63. data/lib/facter/resolvers/memory_resolver.rb +6 -2
  64. data/lib/facter/resolvers/mountpoints_resolver.rb +0 -1
  65. data/lib/facter/resolvers/networking_linux_resolver.rb +0 -1
  66. data/lib/facter/resolvers/networking_resolver.rb +0 -1
  67. data/lib/facter/resolvers/open_vz.rb +0 -1
  68. data/lib/facter/resolvers/os_level_resolver.rb +0 -1
  69. data/lib/facter/resolvers/os_release_resolver.rb +0 -1
  70. data/lib/facter/resolvers/partitions.rb +37 -2
  71. data/lib/facter/resolvers/path_resolver.rb +0 -1
  72. data/lib/facter/resolvers/processors_resolver.rb +0 -1
  73. data/lib/facter/resolvers/puppet_version_resolver.rb +0 -1
  74. data/lib/facter/resolvers/redhat_release_resolver.rb +0 -1
  75. data/lib/facter/resolvers/ruby_resolver.rb +0 -1
  76. data/lib/facter/resolvers/selinux_resolver.rb +0 -1
  77. data/lib/facter/resolvers/solaris/disks.rb +0 -1
  78. data/lib/facter/resolvers/solaris/dmi.rb +0 -1
  79. data/lib/facter/resolvers/solaris/dmi_sparc.rb +0 -1
  80. data/lib/facter/resolvers/solaris/filesystems.rb +0 -1
  81. data/lib/facter/resolvers/solaris/ipaddress.rb +0 -1
  82. data/lib/facter/resolvers/solaris/ldom.rb +0 -1
  83. data/lib/facter/resolvers/solaris/memory.rb +0 -1
  84. data/lib/facter/resolvers/solaris/networking.rb +0 -1
  85. data/lib/facter/resolvers/solaris/os_release.rb +0 -1
  86. data/lib/facter/resolvers/solaris/processors.rb +0 -1
  87. data/lib/facter/resolvers/solaris/zone.rb +0 -1
  88. data/lib/facter/resolvers/solaris/zone_name.rb +0 -1
  89. data/lib/facter/resolvers/ssh_resolver.rb +0 -1
  90. data/lib/facter/resolvers/suse_release_resolver.rb +0 -1
  91. data/lib/facter/resolvers/sw_vers_resolver.rb +0 -1
  92. data/lib/facter/resolvers/timezone_resolver.rb +0 -1
  93. data/lib/facter/resolvers/uname_resolver.rb +0 -1
  94. data/lib/facter/resolvers/uptime_resolver.rb +0 -1
  95. data/lib/facter/resolvers/virt_what.rb +0 -1
  96. data/lib/facter/resolvers/vmware.rb +0 -1
  97. data/lib/facter/resolvers/windows/aio_agent_version.rb +0 -1
  98. data/lib/facter/resolvers/windows/dmi_bios_resolver.rb +0 -1
  99. data/lib/facter/resolvers/windows/dmi_computersystem_resolver.rb +0 -1
  100. data/lib/facter/resolvers/windows/fips_resolver.rb +0 -1
  101. data/lib/facter/resolvers/windows/hardware_architecture_resolver.rb +0 -1
  102. data/lib/facter/resolvers/windows/identity_resolver.rb +0 -1
  103. data/lib/facter/resolvers/windows/kernel_resolver.rb +0 -1
  104. data/lib/facter/resolvers/windows/memory_resolver.rb +0 -1
  105. data/lib/facter/resolvers/windows/netkvm_resolver.rb +0 -1
  106. data/lib/facter/resolvers/windows/networking_resolver.rb +0 -1
  107. data/lib/facter/resolvers/windows/processors_resolver.rb +0 -1
  108. data/lib/facter/resolvers/windows/product_release_resolver.rb +0 -1
  109. data/lib/facter/resolvers/windows/ssh.rb +0 -1
  110. data/lib/facter/resolvers/windows/system32_resolver.rb +0 -1
  111. data/lib/facter/resolvers/windows/uptime_resolver.rb +0 -1
  112. data/lib/facter/resolvers/windows/virtualization_resolver.rb +0 -1
  113. data/lib/facter/resolvers/windows/win_os_description_resolver.rb +0 -1
  114. data/lib/facter/resolvers/wpar_resolver.rb +0 -1
  115. data/lib/facter/resolvers/xen.rb +0 -1
  116. data/lib/facter/resolvers/zfs.rb +0 -1
  117. data/lib/facter/resolvers/zpool.rb +0 -1
  118. data/lib/facter/version.rb +1 -1
  119. metadata +4 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ceb625b0a349be8f5f574055b24aebd9860672ccdfc27224377a75255681b571
4
- data.tar.gz: 1081225dee1a50781041d65599bc74fccf1552fe1ce75a9195f0aecd8608afb8
3
+ metadata.gz: f2ed5162fef26cfbf5bd010cf7737ac8b4856cf59f9f55745d6cfc1bec39781e
4
+ data.tar.gz: 761beee20f449b3bbe1e5dc35c0bcd675e9602902804e7add3ee6c3d31a8916d
5
5
  SHA512:
6
- metadata.gz: 0c31f37ed2064c1683e9f56a5d252bab225e1af0c0df025d1621ef89551fefa6a0816cc3862d4c98ab2480a6e158f62b18bcf0d5ae9f2d75f22799297660ffc9
7
- data.tar.gz: d6f071e0bf9bcdf01c460ea7ac45d0cb50459c4a40e663761cf7c58de0068b6c9e444cebedd5304a692317a960a8d1327accea35f6815b90076e4acc4ce2ec3b
6
+ metadata.gz: 92751ef6452023c4e4edd9c2b7d21bd78bef74404d5550d4de353b4243f6639f29abbba1f00d6f8ba0b4bbf7afbea060f00aa34919a2d1d94459e1df5515e706
7
+ data.tar.gz: b4ca79c0907439874ae638a920def98b9ed0d3e2893a77b6bc3d44dfb3cba756f88e550d55d14a8e4cdb9d2c5b58a6d0c6a6c335955ae819607021a80562cd65
@@ -84,7 +84,7 @@ module LegacyFacter
84
84
  parser = LegacyFacter::Util::Parser.parser_for(fact.file)
85
85
  next if parser.nil?
86
86
 
87
- data = parser.results
87
+ data = resolve_fact(fact, parser)
88
88
 
89
89
  if data == false
90
90
  LegacyFacter.warn "Could not interpret fact file #{fact.file}"
@@ -99,6 +99,14 @@ module LegacyFacter
99
99
  end
100
100
  end
101
101
 
102
+ def resolve_fact(fact, parser)
103
+ data = nil
104
+ fact_name = File.basename(fact.file)
105
+ Facter::Framework::Benchmarking::Timer.measure(fact_name) { data = parser.results }
106
+
107
+ data
108
+ end
109
+
102
110
  def entries
103
111
  dirs = @directories.select { |directory| File.directory?(directory) }.map do |directory|
104
112
  Dir.entries(directory).map { |directory_entry| File.join(directory, directory_entry) }
@@ -118,7 +118,10 @@ module Facter
118
118
 
119
119
  searching do
120
120
  suitable_resolutions = sort_by_weight(find_suitable_resolutions(@resolves))
121
- @value = find_first_real_value(suitable_resolutions)
121
+
122
+ Facter::Framework::Benchmarking::Timer.measure(@name) do
123
+ @value = find_first_real_value(suitable_resolutions)
124
+ end
122
125
 
123
126
  announce_when_no_suitable_resolution(suitable_resolutions)
124
127
  announce_when_no_value_found(@value)
@@ -14,7 +14,7 @@ module Facts
14
14
  mountpoints = Facter::Resolvers::Mountpoints.resolve(:mountpoints)
15
15
  return parts unless mountpoints
16
16
 
17
- mountpoints.each do |mnt|
17
+ mountpoints.reverse_each do |mnt|
18
18
  next unless parts[mnt[:device]]
19
19
 
20
20
  parts[mnt[:device]].merge!(mount: mnt[:path])
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Facts
4
+ module Ubuntu
5
+ class Lsbdistrelease
6
+ FACT_NAME = 'lsbdistrelease'
7
+ ALIASES = %w[lsbmajdistrelease lsbminordistrelease].freeze
8
+ TYPE = :legacy
9
+
10
+ def call_the_resolver
11
+ fact_value = Facter::Resolvers::LsbRelease.resolve(:release)
12
+
13
+ return Facter::ResolvedFact.new(FACT_NAME, nil, :legacy) unless fact_value
14
+
15
+ version = fact_value.split('.')
16
+
17
+ [Facter::ResolvedFact.new(FACT_NAME, fact_value, :legacy),
18
+ Facter::ResolvedFact.new(ALIASES[0], version[0], :legacy),
19
+ Facter::ResolvedFact.new(ALIASES[1], version[1], :legacy)]
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'benchmark'
4
+
5
+ module Facter
6
+ module Framework
7
+ module Benchmarking
8
+ class Timer
9
+ class << self
10
+ def measure(fact_name)
11
+ if Options[:timing]
12
+ time = Benchmark.measure { yield }
13
+
14
+ puts "fact `#{fact_name}`, took: #{time.format('%r')} seconds"
15
+ else
16
+ yield
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -108,6 +108,11 @@ module Facter
108
108
  aliases: '-p',
109
109
  desc: 'Load the Puppet libraries, thus allowing Facter to load Puppet-specific facts.'
110
110
 
111
+ class_option :timing,
112
+ type: :boolean,
113
+ aliases: '-t',
114
+ desc: 'Show how much time it took to resolve each fact'
115
+
111
116
  desc '--man', 'Manual', hide: true
112
117
  map ['--man'] => :man
113
118
  def man(*args)
@@ -36,7 +36,8 @@ module Facter
36
36
  .each do |searched_fact|
37
37
  begin
38
38
  fact = CoreFact.new(searched_fact)
39
- fact_value = fact.create
39
+ fact_value = nil
40
+ Facter::Framework::Benchmarking::Timer.measure(searched_fact.name) { fact_value = fact.create }
40
41
  resolved_facts << fact_value unless fact_value.nil?
41
42
  rescue StandardError => e
42
43
  @@log.log_exception(e)
@@ -30,18 +30,18 @@ module Facter
30
30
  def load_for_os(operating_system)
31
31
  # select only classes
32
32
  classes = ClassDiscoverer.instance.discover_classes(operating_system)
33
-
34
33
  classes.each do |class_name|
35
34
  fact_name = class_name::FACT_NAME
36
-
37
35
  # if fact is already loaded, skip it
38
- next if @facts.any? { |fact| fact.name == fact_name }
39
-
40
- type = class_name.const_defined?('TYPE') ? class_name::TYPE : :core
41
- load_fact(fact_name, class_name, type)
36
+ unless @facts.any? { |fact| fact.name == fact_name }
37
+ type = class_name.const_defined?('TYPE') ? class_name::TYPE : :core
38
+ load_fact(fact_name, class_name, type)
39
+ end
42
40
  next unless class_name.const_defined?('ALIASES')
43
41
 
44
- [*class_name::ALIASES].each { |fact_alias| load_fact(fact_alias, class_name, :legacy) }
42
+ [*class_name::ALIASES].each do |fact_alias|
43
+ load_fact(fact_alias, class_name, :legacy) unless @facts.any? { |fact| fact.name == fact_alias }
44
+ end
45
45
  end
46
46
  end
47
47
 
@@ -39,6 +39,8 @@ load_dir(['resolvers'])
39
39
  load_dir(['facts_utils'])
40
40
  load_dir(%w[framework core])
41
41
  load_dir(['models'])
42
+ load_dir(%w[framework benchmarking])
43
+
42
44
  load_dir(%w[framework core fact_loaders])
43
45
  load_dir(%w[framework core fact internal])
44
46
  load_dir(%w[framework core fact external])
@@ -23,6 +23,7 @@ module Facter
23
23
  @block_list = {}
24
24
  @fact_groups = {}
25
25
  @color = false
26
+ @timing = false
26
27
 
27
28
  class << self
28
29
  attr_reader :debug, :verbose, :log_level, :show_legacy, :ruby,
@@ -31,7 +32,7 @@ module Facter
31
32
  attr_accessor :config, :user_query, :strict, :json, :haml, :external_facts,
32
33
  :cache, :yaml, :puppet, :ttls, :block, :cli, :config_file_custom_dir,
33
34
  :config_file_external_dir, :default_external_dir, :fact_groups,
34
- :block_list, :color, :trace
35
+ :block_list, :color, :trace, :timing
35
36
 
36
37
  attr_writer :external_dir
37
38
 
@@ -159,6 +160,7 @@ module Facter
159
160
  @blocked_facts = []
160
161
  @fact_groups = {}
161
162
  @block_list = {}
163
+ @timing = false
162
164
  end
163
165
 
164
166
  def fallback_external_dir
@@ -2,13 +2,10 @@
2
2
 
3
3
  module Facter
4
4
  class SessionCache
5
- @semaphore = Mutex.new
6
5
  @resolvers = []
7
6
 
8
7
  def self.subscribe(resolver)
9
- @semaphore.synchronize do
10
- @resolvers << resolver
11
- end
8
+ @resolvers << resolver
12
9
  end
13
10
 
14
11
  def self.invalidate_all_caches
@@ -3,7 +3,6 @@
3
3
  module Facter
4
4
  module Resolvers
5
5
  class AioAgentVersion < BaseResolver
6
- @semaphore = Mutex.new
7
6
  @fact_list ||= {}
8
7
 
9
8
  class << self
@@ -4,7 +4,6 @@ module Facter
4
4
  module Resolvers
5
5
  class Architecture < BaseResolver
6
6
  # :architecture
7
- @semaphore = Mutex.new
8
7
  @fact_list ||= {}
9
8
  class << self
10
9
  private
@@ -4,7 +4,6 @@ module Facter
4
4
  module Resolvers
5
5
  module Aix
6
6
  class Disks < BaseResolver
7
- @semaphore = Mutex.new
8
7
  @fact_list ||= {}
9
8
  class << self
10
9
  private
@@ -14,12 +13,12 @@ module Facter
14
13
  end
15
14
 
16
15
  def execute_lspv(fact_name)
17
- @fact_list[:disks] = {}
18
-
19
16
  result = Facter::Core::Execution.execute('lspv', logger: log)
20
17
 
21
18
  return if result.empty?
22
19
 
20
+ @fact_list[:disks] = {}
21
+
23
22
  result.each_line do |line|
24
23
  disk_name = line.split(' ')[0].strip
25
24
  size = find_size(disk_name)
@@ -4,7 +4,6 @@ module Facter
4
4
  module Resolvers
5
5
  module Aix
6
6
  class Filesystem < BaseResolver
7
- @semaphore = Mutex.new
8
7
  @fact_list ||= {}
9
8
 
10
9
  class << self
@@ -4,7 +4,6 @@ module Facter
4
4
  module Resolvers
5
5
  class Hardware < BaseResolver
6
6
  # :hardware
7
- @semaphore = Mutex.new
8
7
  @fact_list ||= {}
9
8
  class << self
10
9
  private
@@ -4,7 +4,6 @@ module Facter
4
4
  module Resolvers
5
5
  module Aix
6
6
  class LoadAverages < BaseResolver
7
- @semaphore = Mutex.new
8
7
  @fact_list ||= {}
9
8
  class << self
10
9
  private
@@ -5,7 +5,6 @@ module Facter
5
5
  module Aix
6
6
  class Memory < BaseResolver
7
7
  # :hardware
8
- @semaphore = Mutex.new
9
8
  @fact_list ||= {}
10
9
  class << self
11
10
  private
@@ -18,11 +17,11 @@ module Facter
18
17
  result = Facter::Core::Execution.execute('svmon', logger: log)
19
18
  return if result.empty?
20
19
 
21
- @fact_list[:system] = @fact_list[:swap] = {}
22
-
23
20
  pagesize = call_pagesize.to_i
24
21
  return if pagesize.zero?
25
22
 
23
+ @fact_list[:system] = @fact_list[:swap] = {}
24
+
26
25
  result.each_line do |line|
27
26
  @fact_list[:system] = populate_system(line, pagesize) if line.include?('memory')
28
27
  @fact_list[:swap] = populate_swap(line, pagesize) if line =~ /pg\sspace/
@@ -4,7 +4,6 @@ module Facter
4
4
  module Resolvers
5
5
  module Aix
6
6
  class Mountpoints < BaseResolver
7
- @semaphore = Mutex.new
8
7
  @fact_list ||= {}
9
8
  BLOCK_SIZE = 512
10
9
 
@@ -4,7 +4,6 @@ module Facter
4
4
  module Resolvers
5
5
  module Aix
6
6
  class Networking < BaseResolver
7
- @semaphore = Mutex.new
8
7
  @fact_list ||= {}
9
8
 
10
9
  class << self
@@ -4,7 +4,6 @@ module Facter
4
4
  module Resolvers
5
5
  module Aix
6
6
  class Nim < BaseResolver
7
- @semaphore = Mutex.new
8
7
  @fact_list ||= {}
9
8
 
10
9
  class << self
@@ -3,7 +3,6 @@
3
3
  module Facter
4
4
  module Resolvers
5
5
  class OsLevel < BaseResolver
6
- @semaphore = Mutex.new
7
6
  @fact_list ||= {}
8
7
 
9
8
  class << self
@@ -4,7 +4,6 @@ module Facter
4
4
  module Resolvers
5
5
  module Aix
6
6
  class Partitions < BaseResolver
7
- @semaphore = Mutex.new
8
7
  @fact_list ||= {}
9
8
  class << self
10
9
  private
@@ -14,8 +13,6 @@ module Facter
14
13
  end
15
14
 
16
15
  def query_cudv(fact_name)
17
- @fact_list[:partitions] = {}
18
-
19
16
  odmquery = Facter::ODMQuery.new
20
17
  odmquery.equals('PdDvLn', 'logical_volume/lvsubclass/lvtype')
21
18
 
@@ -23,6 +20,8 @@ module Facter
23
20
 
24
21
  return unless result
25
22
 
23
+ @fact_list[:partitions] = {}
24
+
26
25
  result.each_line do |line|
27
26
  next unless line.include?('name')
28
27
 
@@ -4,7 +4,6 @@ module Facter
4
4
  module Resolvers
5
5
  module Aix
6
6
  class Processors < BaseResolver
7
- @semaphore = Mutex.new
8
7
  @fact_list ||= {}
9
8
  class << self
10
9
  private
@@ -4,7 +4,6 @@ module Facter
4
4
  module Resolvers
5
5
  module Aix
6
6
  class Serialnumber < BaseResolver
7
- @semaphore = Mutex.new
8
7
  @fact_list ||= {}
9
8
 
10
9
  class << self
@@ -3,7 +3,6 @@
3
3
  module Facter
4
4
  module Resolvers
5
5
  class Augeas < BaseResolver
6
- @semaphore = Mutex.new
7
6
  @fact_list ||= {}
8
7
 
9
8
  class << self
@@ -16,15 +16,20 @@ module Facter
16
16
  end
17
17
 
18
18
  def self.resolve(fact_name)
19
- @semaphore.synchronize do
20
- subscribe_to_manager
21
- post_resolve(fact_name)
22
- end
19
+ subscribe_to_manager
20
+ post_resolve(fact_name)
21
+
22
+ validate_resolution(fact_name)
23
23
  rescue LoadError, NameError => e
24
24
  log.debug("resolving fact #{fact_name}, but #{e}")
25
25
  @fact_list[fact_name] = nil
26
26
  end
27
27
 
28
+ def self.validate_resolution(fact_name)
29
+ @fact_list.fetch(fact_name) { @fact_list[fact_name] = nil }
30
+ @fact_list[fact_name]
31
+ end
32
+
28
33
  def self.post_resolve(_fact_name)
29
34
  raise NotImplementedError, "You must implement post_resolve(fact_name) method in #{name}"
30
35
  end
@@ -5,7 +5,6 @@ module Facter
5
5
  module Bsd
6
6
  class Processors < BaseResolver
7
7
  @log = Facter::Log.new(self)
8
- @semaphore = Mutex.new
9
8
  @fact_list ||= {}
10
9
  class << self
11
10
  private
@@ -6,7 +6,6 @@ module Facter
6
6
  # :virtual
7
7
  # :hypervisor
8
8
 
9
- @semaphore = Mutex.new
10
9
  @fact_list ||= {}
11
10
  INFO = { 'docker' => 'id', 'lxc' => 'name' }.freeze
12
11
 
@@ -7,7 +7,6 @@ module Facter
7
7
  # :minor
8
8
  # :full
9
9
 
10
- @semaphore = Mutex.new
11
10
  @fact_list ||= {}
12
11
 
13
12
  class << self
@@ -5,7 +5,6 @@ module Facter
5
5
  module Linux
6
6
  class Disk < BaseResolver
7
7
  @log = Facter::Log.new(self)
8
- @semaphore = Mutex.new
9
8
  @fact_list ||= {}
10
9
  DIR = '/sys/block'
11
10
  FILE_PATHS = { model: 'device/model', size: 'size', vendor: 'device/vendor' }.freeze