Puppet Version: N/A — 6.14.0 Puppet Server Version: N/A — 6.9.2 OS Name/Version: FreeBSD While adding support of FreeBSD to facter-ng, we discovered that the fact resolution was not behaving as expected. Inspecting the resolved facts after this line: https://github.com/puppetlabs/facter-ng/blob/6323e3b6ef72271aa8176ad9662d649dc5442a53/lib/framework/core/fact/internal/internal_fact_manager.rb#L40 shows that a single fact (os.release) was resolved with by the Solaris and the Bsd providers, and they have been resolved multiple times (at the time of writting, the bsd provider is not part of facter yet): puts resolved_facts.select { |r| r.name == 'os.release' }.map(&:value) {{ {"full"=>nil, "major"=>nil, "minor"=>nil} {"full"=>"12.1-RELEASE-p3", "major"=>"12", "minor"=>"1", "branch"=>"RELEASE-p3", "patchlevel"=>"3"}{"full"=>nil, "major"=>nil, "minor"=>nil} {"full"=>"12.1-RELEASE-p3", "major"=>"12", "minor"=>"1", "branch"=>"RELEASE-p3", "patchlevel"=>"3"} {"full"=>nil, "major"=>nil, "minor"=>nil}{"full"=>"12.1-RELEASE-p3", "major"=>"12", "minor"=>"1", "branch"=>"RELEASE-p3", "patchlevel"=>"3"} {"full"=>nil, "major"=>nil, "minor"=>nil} {"full"=>"12.1-RELEASE-p3", "major"=>"12", "minor"=>"1", "branch"=>"RELEASE-p3", "patchlevel"=>"3"}{"full"=>nil, "major"=>nil, "minor"=>nil} {"full"=>"12.1-RELEASE-p3", "major"=>"12", "minor"=>"1", "branch"=>"RELEASE-p3", "patchlevel"=>"3"} {"full"=>nil, "major"=>nil, "minor"=>nil}{"full"=>"12.1-RELEASE-p3", "major"=>"12", "minor"=>"1", "branch"=>"RELEASE-p3", "patchlevel"=>"3"} }} Desired Behavior: The fact should be resolved only once and only with the appropriate provider. Actual Behavior: Facts are resolved by multiple providers multiple times. Current WIP FreeBSD provider for os.release : {{# frozen_string_literal: true module Facts module Bsd module Os class Release FACT_NAME = 'os.release' ALIASES = %w[operatingsystemmajrelease operatingsystemrelease].freeze def call_the_resolver puts "# {Thread.current} FREE" /(?<full_value>(?<major_value>\d+)\.(?<minor_value>\d+)-(?<branch_value>CURRENT|STABLE|RELEASE(-p(?<patchlevel_value>\d+))?))/ =~ `/bin/freebsd-version` [Facter::ResolvedFact.new(FACT_NAME, full: full_value, major: major_value, minor: minor_value, branch: branch_value, patchlevel: patchlevel_value), Facter::ResolvedFact.new(ALIASES.first, major_value, :legacy), Facter::ResolvedFact.new(ALIASES.last, full_value, :legacy)] end end end end end }} |