Jira (FACT-2354) Provide fact fixtures on new facter releases to facterdb

11 views
Skip to first unread message

Tim Meusel (JIRA)

unread,
Feb 10, 2020, 12:18:04 PM2/10/20
to puppe...@googlegroups.com
Tim Meusel created an issue
 
Facter / Task FACT-2354
Provide fact fixtures on new facter releases to facterdb
Issue Type: Task Task
Assignee: Unassigned
Created: 2020/02/10 9:17 AM
Priority: Normal Normal
Reporter: Tim Meusel

Hi,
to my understanding it's common practice to use rspec-puppet-facts for spec tests. The tool iterates on every operating system in the metadata.json and uses matching fact sets from facterdb. We try to use the correct facter version for the puppet version we're testing on:

# 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
#
# The environment variable `PUPPET_VERSION` is available in our travis environment, but we cannot rely on it
# if somebody runs the tests locally. For that case we should fallback the the puppet gem version.
def suggest_facter_version
  puppet_version = ENV['PUPPET_VERSION'] ? ENV['PUPPET_VERSION'] : Gem.loaded_specs['puppet'].version.to_s
  Gem::Dependency.new('', puppet_version).match?('', '5') ? '3.11.0' : '3.14.0'
end
 
RSpec.configure do |config|
  config.default_facter_version = ENV['FACTERDB_FACTS_VERSION'] || suggest_facter_version
end

We think this is a good approach. Please correct me if I'm wrong. Do make this work, we need to add new fact sets to facterdb on minor/major release you do. This is tricky, especially since the gem maintainer don't have necessarily access to all the operating systems. This would be way easier if you could provide those fact sets within your release process of facter.

This idea came up after a short discussion with Gene Liverman. CC: Ben Ford / David Schmitt

Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v7.7.1#77002-sha1:e75ca93)
Atlassian logo

Tara Krishnan (JIRA)

unread,
Feb 11, 2020, 11:05:05 AM2/11/20
to puppe...@googlegroups.com
Tara Krishnan commented on Task FACT-2354
 
Re: Provide fact fixtures on new facter releases to facterdb

Currently our team does not have the bandwidth to own this, but if Gene Liverman wants to own this we are happy to provide support. 

cc Mihai Buzgau

Gene Liverman (JIRA)

unread,
Feb 11, 2020, 11:22:06 AM2/11/20
to puppe...@googlegroups.com

I am game for owning this. Is Nights Watch who I would need to coordinate with?

cc: Christopher Thorn David Hayden

Tara Krishnan (JIRA)

unread,
Feb 11, 2020, 11:31:06 AM2/11/20
to puppe...@googlegroups.com

Tim Meusel (JIRA)

unread,
Feb 11, 2020, 12:51:04 PM2/11/20
to puppe...@googlegroups.com
Tim Meusel commented on Task FACT-2354

The team that maintains the Puppet modules might be interested in this as well, since most of their modules also use rspec-puppet-facts.

Jesse Scott (JIRA)

unread,
Feb 12, 2020, 12:06:05 PM2/12/20
to puppe...@googlegroups.com
Jesse Scott commented on Task FACT-2354

Note that the default mapping of Puppet Agent version to Facter version will be automatic in a future release of rspec-puppet-facts. The code has already landed (https://github.com/mcanevet/rspec-puppet-facts/pull/109) but there was some breakage of existing tests so we think it's best if it goes out in a major version bump.

That doesn't solve for making sure fact sets are up to date in facterdb though, but we have been tracking that work in https://tickets.puppetlabs.com/browse/PDK-687 and I think Tim Sharpe has done a little bit of work on a solution already, probably be good to sync up with him.

Reply all
Reply to author
Forward
0 new messages