Skip to content

Commit

Permalink
Fake facter version to get support for structured facts
Browse files Browse the repository at this point in the history
  • Loading branch information
baurmatt committed Jan 9, 2020
1 parent 768ffa2 commit fb71a2f
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,17 @@
end

RSpec.configure do |c|
# getting the correct facter version is tricky. We use facterdb as a source to mock facts
# see https://github.com/camptocamp/facterdb
# people might provide a specific facter version. In that case we use it.
# Otherwise we need to match the correct facter version to the used puppet version.
# as of 2019-10-31, puppet 5 ships facter 3.11 and puppet 6 ships facter 3.14
# https://puppet.com/docs/puppet/5.5/about_agent.html
c.default_facter_version = if ENV['FACTERDB_FACTS_VERSION']
ENV['FACTERDB_FACTS_VERSION']
else
Gem::Dependency.new('', ENV['PUPPET_VERSION']).match?('', '5') ? '3.11.0' : '3.14.0'
end

c.hiera_config = File.expand_path(File.join(__FILE__, '../fixtures/hiera.yaml'))
end

0 comments on commit fb71a2f

Please sign in to comment.