Skip to content

Commit

Permalink
Confine custom fact to only execute on Linux systems
Browse files Browse the repository at this point in the history
This module can also be used to configure Foreman SCAP clients via an external Puppet server, separate to Foreman/Satellite.

Because an external Puppet server may also manage Windows systems, the Windows systems attempt to resolve this fact and it produces this error in Puppet run logs: 

"Facter
Error while resolving custom fact fact='rh_certificate', resolution='': break from proc-closure"

This can be easily avoided by confining the custom fact to execute only for systems whose kernel fact value is "Linux".

Reference: https://www.puppet.com/docs/puppet/8/custom_facts.html#confining-facts
  • Loading branch information
amandaharth authored and ekohl committed Dec 4, 2023
1 parent fbd5679 commit b5f58f0
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions lib/facter/rh_certificates.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
Facter.add('rh_certificate') do
confine kernel: 'Linux'
setcode do
data = Facter::Util::Resolution.exec('/usr/sbin/subscription-manager config')
break if data.nil? || data.empty?
Expand Down

0 comments on commit b5f58f0

Please sign in to comment.