Skip to content

Commit

Permalink
Use FacterDB.filter_results
Browse files Browse the repository at this point in the history
  • Loading branch information
ekohl committed Sep 13, 2024
1 parent 5fcc51c commit 70f4c33
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@ group :coverage, optional: ENV['COVERAGE'] != 'yes' do
gem 'codecov', require: false
gem 'simplecov-console', require: false
end

gem 'facterdb', github: 'ekohl/facterdb', branch: 'filter-results'
3 changes: 1 addition & 2 deletions lib/rspec-puppet-facts.rb
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,8 @@ def on_supported_os_implementation(opts = {})
# FacterDB may have newer versions of facter data for which it contains a subset of all possible
# facter data (see FacterDB 0.5.2 for Facter releases 3.8 and 3.9). In this situation we need to
# cycle through and downgrade Facter versions per platform type until we find matching Facter data.
json_db = db.to_json
filter.each do |filter_spec|
versions = JGrep.jgrep(json_db, FacterDB.generate_filter_str(filter_spec)).to_h do |facts|
versions = FacterDB.filter_results(db, filter_spec).to_h do |facts|
result = RSpec.configuration.facterdb_string_keys ? facts : facts.transform_keys(&:to_sym)
[Gem::Version.new(facts['facterversion']), result]
end
Expand Down

0 comments on commit 70f4c33

Please sign in to comment.