@@ -83,6 +83,7 @@ def clear
8383 Options [ :custom_dir ] = [ ]
8484 LegacyFacter . collection . invalidate_custom_facts
8585 LegacyFacter . collection . reload_custom_facts
86+ SessionCache . invalidate_all_caches
8687 end
8788
8889 def core_value ( user_query )
@@ -170,7 +171,6 @@ def debugging(debug_bool)
170171 def each
171172 log_blocked_facts
172173 resolved_facts = Facter ::FactManager . instance . resolve_facts
173- SessionCache . invalidate_all_caches
174174
175175 resolved_facts . each do |fact |
176176 yield ( fact . name , fact . value )
@@ -206,6 +206,7 @@ def reset
206206 LegacyFacter . reset
207207 Options [ :custom_dir ] = [ ]
208208 Options [ :external_dir ] = [ ]
209+ SessionCache . invalidate_all_caches
209210 nil
210211 end
211212
@@ -270,7 +271,6 @@ def to_hash
270271 log_blocked_facts
271272
272273 resolved_facts = Facter ::FactManager . instance . resolve_facts
273- Facter ::SessionCache . invalidate_all_caches
274274 Facter ::FactCollection . new . build_fact_collection! ( resolved_facts )
275275 end
276276
@@ -308,7 +308,6 @@ def value(user_query)
308308 def values ( options , user_queries )
309309 init_cli_options ( options , user_queries )
310310 resolved_facts = Facter ::FactManager . instance . resolve_facts ( user_queries )
311- Facter ::SessionCache . invalidate_all_caches
312311
313312 if user_queries . count . zero?
314313 Facter ::FactCollection . new . build_fact_collection! ( resolved_facts )
@@ -336,7 +335,6 @@ def to_user_output(cli_options, *args)
336335 logger . info ( "executed with command line: #{ ARGV . drop ( 1 ) . join ( ' ' ) } " )
337336 log_blocked_facts
338337 resolved_facts = Facter ::FactManager . instance . resolve_facts ( args )
339- SessionCache . invalidate_all_caches
340338 fact_formatter = Facter ::FormatterFactory . build ( Facter ::Options . get )
341339
342340 status = error_check ( resolved_facts )
@@ -426,7 +424,6 @@ def add_fact_to_searched_facts(user_query, value)
426424 def resolve_fact ( user_query )
427425 user_query = user_query . to_s
428426 resolved_facts = Facter ::FactManager . instance . resolve_facts ( [ user_query ] )
429- SessionCache . invalidate_all_caches
430427 # we must make a distinction between custom facts that return nil and nil facts
431428 # Nil facts should not be packaged as ResolvedFacts! (add_fact_to_searched_facts packages facts)
432429 resolved_facts = resolved_facts . reject { |fact | fact . type == :nil }
0 commit comments