facter 4.0.11 → 4.0.12

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4dc756f457596cb1e7c5dc236119090baa3bdc669e4cd35e9820144cf8d1b585
4
- data.tar.gz: 78f30898f661ecd030dd0857f4f68e38ac55f1c8efe551f24e8a4f5c97ab8c77
3
+ metadata.gz: 9a35e635fbb713ca5ee0179eb5d82d156682164d849f1d144d8b575d504d6cce
4
+ data.tar.gz: e8ec1444f543d735972a7d246d87f0f1bece3153f9cedd9b7f253c3d53c48c51
5
5
  SHA512:
6
- metadata.gz: 0a62ed7d388386b6515c685cbeaefad0385914c4715ee8c117dc2057ed7042ca8053c05a2abb748fcd69028733975fb8458e276eb50bd8215d480c9deebbbc3b
7
- data.tar.gz: 4057a5d3ebd48e8e5296542a5ebfa052e55cbfbc726e9bb7b931145941894a31b1b89daa69251a816935bbfe83814d41818046d2e0a23826ecd619b6588b2e13
6
+ metadata.gz: fbe14240f8e0b735e67258583d0122459d4c58e98316aa2790eee2e29aa6621f60665c405798789b94f6a59dd6e5b680498c41a09c5d86d0b04522b28ac12408
7
+ data.tar.gz: 9c8c1b6b02de006a8b6188cc178402ceba4deda9600e9dec9cc2666a44a72e25dcb8361681e714b6ca808fe4078863db3a442b490fc80ec938cc63a1d5c7f65a
@@ -1,6 +1,6 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config --exclude-limit 1000`
3
- # on 2020-03-17 13:36:57 +0200 using RuboCop version 0.74.0.
3
+ # on 2020-03-19 13:55:15 +0200 using RuboCop version 0.74.0.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
@@ -54,13 +54,12 @@ RSpec/ContextWording:
54
54
  - 'spec/framework/core/options_spec.rb'
55
55
  - 'spec/framework/formatters/legacy_fact_formatter_spec.rb'
56
56
 
57
- # Offense count: 31
57
+ # Offense count: 29
58
58
  RSpec/ExpectInHook:
59
59
  Exclude:
60
60
  - 'spec/custom_facts/core/execution/fact_manager_spec.rb'
61
61
  - 'spec/facter/facts/aix/load_averages_spec.rb'
62
62
  - 'spec/facter/facts/macosx/filesystems_spec.rb'
63
- - 'spec/facter/facts/macosx/identity/privileged_spec.rb'
64
63
  - 'spec/facter/resolvers/aix/ffi_helper_spec.rb'
65
64
  - 'spec/facter/resolvers/lpar_resolver_spec.rb'
66
65
  - 'spec/facter/resolvers/solaris/current_zone_resolver_spec.rb'
@@ -179,7 +178,7 @@ RSpec/LeakyConstantDeclaration:
179
178
  - 'spec/facter/resolvers/macosx/mountpoints_resolver_spec.rb'
180
179
  - 'spec/facter/resolvers/utils/windows/network_utils_spec.rb'
181
180
 
182
- # Offense count: 326
181
+ # Offense count: 322
183
182
  # Configuration parameters: EnforcedStyle.
184
183
  # SupportedStyles: have_received, receive
185
184
  RSpec/MessageSpies:
@@ -206,8 +205,6 @@ RSpec/MessageSpies:
206
205
  - 'spec/facter/facts/aix/networking/hostname_spec.rb'
207
206
  - 'spec/facter/facts/aix/networking/ip_spec.rb'
208
207
  - 'spec/facter/facts/aix/networking/primary_spec.rb'
209
- - 'spec/facter/facts/aix/os/architecture_spec.rb'
210
- - 'spec/facter/facts/aix/os/family_spec.rb'
211
208
  - 'spec/facter/facts/aix/os/name_spec.rb'
212
209
  - 'spec/facter/facts/aix/os/release_spec.rb'
213
210
  - 'spec/facter/facts/aix/ruby/version_spec.rb'
@@ -226,7 +223,6 @@ RSpec/MessageSpies:
226
223
  - 'spec/facter/facts/el/networking/ip_spec.rb'
227
224
  - 'spec/facter/facts/el/networking/primary_spec.rb'
228
225
  - 'spec/facter/facts/macosx/filesystems_spec.rb'
229
- - 'spec/facter/facts/macosx/identity/privileged_spec.rb'
230
226
  - 'spec/facter/facts/macosx/is_virtual_spec.rb'
231
227
  - 'spec/facter/facts/macosx/memory/swap/used_spec.rb'
232
228
  - 'spec/facter/facts/macosx/memory/system/used_spec.rb'
@@ -354,7 +350,7 @@ RSpec/SubjectStub:
354
350
  - 'spec/custom_facts/util/fact_spec.rb'
355
351
  - 'spec/custom_facts/util/resolution_spec.rb'
356
352
 
357
- # Offense count: 246
353
+ # Offense count: 242
358
354
  # Configuration parameters: IgnoreNameless, IgnoreSymbolicNames.
359
355
  RSpec/VerifiedDoubles:
360
356
  Exclude:
@@ -371,10 +367,7 @@ RSpec/VerifiedDoubles:
371
367
  - 'spec/facter/facts/aix/kernelrelease_spec.rb'
372
368
  - 'spec/facter/facts/aix/kernelversion_spec.rb'
373
369
  - 'spec/facter/facts/aix/load_averages_spec.rb'
374
- - 'spec/facter/facts/aix/os/hardware_spec.rb'
375
370
  - 'spec/facter/facts/aix/path_spec.rb'
376
- - 'spec/facter/facts/aix/ruby/platform_spec.rb'
377
- - 'spec/facter/facts/aix/ruby/sitedir_spec.rb'
378
371
  - 'spec/facter/facts/aix/ssh_spec.rb'
379
372
  - 'spec/facter/facts/debian/facterversion_spec.rb'
380
373
  - 'spec/facter/facts/debian/kernel_spec.rb'
@@ -390,7 +383,6 @@ RSpec/VerifiedDoubles:
390
383
  - 'spec/facter/facts/el/path_spec.rb'
391
384
  - 'spec/facter/facts/macosx/facterversion_spec.rb'
392
385
  - 'spec/facter/facts/macosx/filesystems_spec.rb'
393
- - 'spec/facter/facts/macosx/identity/privileged_spec.rb'
394
386
  - 'spec/facter/facts/macosx/kernel_spec.rb'
395
387
  - 'spec/facter/facts/macosx/kernelmajversion_spec.rb'
396
388
  - 'spec/facter/facts/macosx/kernelrelease_spec.rb'
data/VERSION CHANGED
@@ -1 +1 @@
1
- 4.0.11
1
+ 4.0.12
@@ -11,6 +11,7 @@ module LegacyFacter
11
11
  @facts = {}
12
12
  @internal_loader = internal_loader
13
13
  @external_loader = external_loader
14
+ @loaded = false
14
15
  end
15
16
 
16
17
  # Return a fact object by name.
@@ -98,12 +99,24 @@ module LegacyFacter
98
99
  @external_facts = Facter::Utils.deep_copy(external_facts.keys)
99
100
  end
100
101
 
102
+ def invalidate_custom_facts
103
+ @valid_custom_facts = false
104
+ end
105
+
106
+ def reload_custom_facts
107
+ @loaded = false
108
+ end
109
+
101
110
  # Builds a hash of custom facts
102
111
  def custom_facts
103
- return @custom_facts unless @custom_facts.nil?
112
+ return @custom_facts if @valid_custom_facts
104
113
 
105
- internal_loader.load_all
106
- custom_facts = @facts.select { |_k, v| v.options[:fact_type] }
114
+ @valid_custom_facts = true
115
+
116
+ internal_loader.load_all unless @loaded
117
+ @loaded = true
118
+
119
+ custom_facts = @facts.select { |_k, v| v.options[:fact_type] == :custom }
107
120
  @custom_facts = Facter::Utils.deep_copy(custom_facts.keys)
108
121
  end
109
122
 
@@ -45,6 +45,7 @@ module Facter
45
45
  def add(name, options = {}, &block)
46
46
  options[:fact_type] = :custom
47
47
  LegacyFacter.add(name, options, &block)
48
+ LegacyFacter.collection.invalidate_custom_facts
48
49
  end
49
50
 
50
51
  # Clears all cached values and removes all facts from memory.
@@ -55,6 +56,8 @@ module Facter
55
56
  def clear
56
57
  @already_searched = {}
57
58
  LegacyFacter.clear
59
+ LegacyFacter.collection.invalidate_custom_facts
60
+ LegacyFacter.collection.reload_custom_facts
58
61
  end
59
62
 
60
63
  def core_value(user_query)
@@ -5,11 +5,12 @@ module Facts
5
5
  module Os
6
6
  class Hardware
7
7
  FACT_NAME = 'os.hardware'
8
+ ALIASES = 'hardwaremodel'
8
9
 
9
10
  def call_the_resolver
10
11
  fact_value = Facter::Resolvers::Hardware.resolve(:hardware)
11
12
 
12
- Facter::ResolvedFact.new(FACT_NAME, fact_value)
13
+ [Facter::ResolvedFact.new(FACT_NAME, fact_value), Facter::ResolvedFact.new(ALIASES, fact_value, :legacy)]
13
14
  end
14
15
  end
15
16
  end
@@ -5,10 +5,11 @@ module Facts
5
5
  module Ruby
6
6
  class Platform
7
7
  FACT_NAME = 'ruby.platform'
8
+ ALIASES = 'rubyplatform'
8
9
 
9
10
  def call_the_resolver
10
11
  fact_value = Facter::Resolvers::Ruby.resolve(:platform)
11
- Facter::ResolvedFact.new(FACT_NAME, fact_value)
12
+ [Facter::ResolvedFact.new(FACT_NAME, fact_value), Facter::ResolvedFact.new(ALIASES, fact_value, :legacy)]
12
13
  end
13
14
  end
14
15
  end
@@ -5,10 +5,11 @@ module Facts
5
5
  module Ruby
6
6
  class Sitedir
7
7
  FACT_NAME = 'ruby.sitedir'
8
+ ALIASES = 'rubysitedir'
8
9
 
9
10
  def call_the_resolver
10
11
  fact_value = Facter::Resolvers::Ruby.resolve(:sitedir)
11
- Facter::ResolvedFact.new(FACT_NAME, fact_value)
12
+ [Facter::ResolvedFact.new(FACT_NAME, fact_value), Facter::ResolvedFact.new(ALIASES, fact_value, :legacy)]
12
13
  end
13
14
  end
14
15
  end
@@ -5,10 +5,11 @@ module Facts
5
5
  module SystemUptime
6
6
  class Days
7
7
  FACT_NAME = 'system_uptime.days'
8
+ ALIASES = 'uptime_days'
8
9
 
9
10
  def call_the_resolver
10
11
  fact_value = Facter::Resolvers::Uptime.resolve(:days)
11
- Facter::ResolvedFact.new(FACT_NAME, fact_value)
12
+ [Facter::ResolvedFact.new(FACT_NAME, fact_value), Facter::ResolvedFact.new(ALIASES, fact_value, :legacy)]
12
13
  end
13
14
  end
14
15
  end
@@ -5,10 +5,11 @@ module Facts
5
5
  module SystemUptime
6
6
  class Hours
7
7
  FACT_NAME = 'system_uptime.hours'
8
+ ALIASES = 'uptime_hours'
8
9
 
9
10
  def call_the_resolver
10
11
  fact_value = Facter::Resolvers::Uptime.resolve(:hours)
11
- Facter::ResolvedFact.new(FACT_NAME, fact_value)
12
+ [Facter::ResolvedFact.new(FACT_NAME, fact_value), Facter::ResolvedFact.new(ALIASES, fact_value, :legacy)]
12
13
  end
13
14
  end
14
15
  end
@@ -5,10 +5,11 @@ module Facts
5
5
  module SystemUptime
6
6
  class Seconds
7
7
  FACT_NAME = 'system_uptime.seconds'
8
+ ALIASES = 'uptime_seconds'
8
9
 
9
10
  def call_the_resolver
10
11
  fact_value = Facter::Resolvers::Uptime.resolve(:seconds)
11
- Facter::ResolvedFact.new(FACT_NAME, fact_value)
12
+ [Facter::ResolvedFact.new(FACT_NAME, fact_value), Facter::ResolvedFact.new(ALIASES, fact_value, :legacy)]
12
13
  end
13
14
  end
14
15
  end
@@ -5,10 +5,11 @@ module Facts
5
5
  module SystemUptime
6
6
  class Uptime
7
7
  FACT_NAME = 'system_uptime.uptime'
8
+ ALIASES = 'uptime'
8
9
 
9
10
  def call_the_resolver
10
11
  fact_value = Facter::Resolvers::Uptime.resolve(:uptime)
11
- Facter::ResolvedFact.new(FACT_NAME, fact_value)
12
+ [Facter::ResolvedFact.new(FACT_NAME, fact_value), Facter::ResolvedFact.new(ALIASES, fact_value, :legacy)]
12
13
  end
13
14
  end
14
15
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: facter
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.11
4
+ version: 4.0.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Puppet
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-03-18 00:00:00.000000000 Z
11
+ date: 2020-03-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler