From 651fd7669c62fa03e801a529273f89c74b6dfaf3 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Tue, 8 Sep 2026 13:31:07 +0200 Subject: [PATCH 1/3] print "Loading facts" just once in the past, we printed "Loading facts" for every directory where we search for facts. This just created a bunch of noise. Co-authored-by: Michael Harp Signed-off-by: Tim Meusel --- lib/puppet/indirector/facts/facter.rb | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/lib/puppet/indirector/facts/facter.rb b/lib/puppet/indirector/facts/facter.rb index f2f5f36725..577b9e92fa 100644 --- a/lib/puppet/indirector/facts/facter.rb +++ b/lib/puppet/indirector/facts/facter.rb @@ -62,21 +62,20 @@ def self.setup_search_paths(request) end end.flatten + Puppet[:factpath].split(File::PATH_SEPARATOR) - dirs = dirs.select do |dir| - next false unless FileTest.directory?(dir) - - # Even through we no longer directly load facts in the terminus, - # print out each .rb in the facts directory as module - # developers may find that information useful for debugging purposes - if Puppet::Util::Log.sendlevel?(:info) - Puppet.info _("Loading facts") + dirs.select! { |dir| FileTest.directory?(dir) } + + # Even through we no longer directly load facts in the terminus, + # print out each .rb in the facts directory as module + # developers may find that information useful for debugging purposes + if Puppet::Util::Log.sendlevel?(:info) && !dirs.empty? + Puppet.info _("Loading facts") + dirs.each do |dir| Dir.glob("#{dir}/*.rb").each do |file| Puppet.debug { "Loading facts from #{file}" } end end - - true end + dirs << request.options[:custom_dir] if request.options[:custom_dir] Puppet.runtime[:facter].search(*dirs) end From 8a688db76629c8269dcae94342a42b74bd0c0b5c Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Tue, 8 Sep 2026 16:19:02 +0200 Subject: [PATCH 2/3] facter.rb: Fix typo Co-authored-by: Michael Harp Signed-off-by: Tim Meusel --- lib/puppet/indirector/facts/facter.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/puppet/indirector/facts/facter.rb b/lib/puppet/indirector/facts/facter.rb index 577b9e92fa..eff732b2a5 100644 --- a/lib/puppet/indirector/facts/facter.rb +++ b/lib/puppet/indirector/facts/facter.rb @@ -64,7 +64,7 @@ def self.setup_search_paths(request) dirs.select! { |dir| FileTest.directory?(dir) } - # Even through we no longer directly load facts in the terminus, + # Even though we no longer directly load facts in the terminus, # print out each .rb in the facts directory as module # developers may find that information useful for debugging purposes if Puppet::Util::Log.sendlevel?(:info) && !dirs.empty? From b7893be0821c7c94c1095614ff68f0f50518f17a Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Tue, 8 Sep 2026 16:25:05 +0200 Subject: [PATCH 3/3] restructure debug logging Co-authored-by: Michael Harp Signed-off-by: Tim Meusel --- lib/puppet/indirector/facts/facter.rb | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/puppet/indirector/facts/facter.rb b/lib/puppet/indirector/facts/facter.rb index eff732b2a5..f38603967e 100644 --- a/lib/puppet/indirector/facts/facter.rb +++ b/lib/puppet/indirector/facts/facter.rb @@ -67,11 +67,13 @@ def self.setup_search_paths(request) # Even though we no longer directly load facts in the terminus, # print out each .rb in the facts directory as module # developers may find that information useful for debugging purposes - if Puppet::Util::Log.sendlevel?(:info) && !dirs.empty? + unless dirs.empty? Puppet.info _("Loading facts") - dirs.each do |dir| - Dir.glob("#{dir}/*.rb").each do |file| - Puppet.debug { "Loading facts from #{file}" } + if Puppet::Util::Log.sendlevel?(:debug) + dirs.each do |dir| + Dir.glob("#{dir}/*.rb").each do |file| + Puppet.debug { "Loading facts from #{file}" } + end end end end