Skip to content

Commit

Permalink
rework cache_manager logic about cached facts and groups
Browse files Browse the repository at this point in the history
If one fact is missing in group - we don't want to delete whole facts group - only recalculate missing fact if we need.
Should fix
#2712
  • Loading branch information
sharewax authored Oct 1, 2024
1 parent bbb2d35 commit 95cb07c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/facter/framework/core/cache_manager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,9 @@ def read_fact(searched_fact, fact_group)
unless searched_fact.file
return unless valid_format_version?(searched_fact, data, fact_group)

delete_cache(fact_group) unless data.keys.grep(/#{searched_fact.name}/).any?
# data.fetch(searched_fact.name) { delete_cache(fact_group) }
unless data.keys.grep(/#{searched_fact.name}/).any?
@log.debug("Fact '#{searched_fact.name}' missing from group '#{fact_group}', skipping cache removal.")
end
end

@log.debug("loading cached values for #{searched_fact.name} facts")
Expand Down

0 comments on commit 95cb07c

Please sign in to comment.