Skip to content

Commit 70f4c33

Browse files
committed
Use FacterDB.filter_results
1 parent 5fcc51c commit 70f4c33

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

Gemfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,5 @@ group :coverage, optional: ENV['COVERAGE'] != 'yes' do
1313
gem 'codecov', require: false
1414
gem 'simplecov-console', require: false
1515
end
16+
17+
gem 'facterdb', github: 'ekohl/facterdb', branch: 'filter-results'

lib/rspec-puppet-facts.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,8 @@ def on_supported_os_implementation(opts = {})
122122
# FacterDB may have newer versions of facter data for which it contains a subset of all possible
123123
# facter data (see FacterDB 0.5.2 for Facter releases 3.8 and 3.9). In this situation we need to
124124
# cycle through and downgrade Facter versions per platform type until we find matching Facter data.
125-
json_db = db.to_json
126125
filter.each do |filter_spec|
127-
versions = JGrep.jgrep(json_db, FacterDB.generate_filter_str(filter_spec)).to_h do |facts|
126+
versions = FacterDB.filter_results(db, filter_spec).to_h do |facts|
128127
result = RSpec.configuration.facterdb_string_keys ? facts : facts.transform_keys(&:to_sym)
129128
[Gem::Version.new(facts['facterversion']), result]
130129
end

0 commit comments

Comments
 (0)