theforeman / theforeman/puppet-puppet

puppet.conf changes are needlessly noisy in runmode=systemd.timer

Open
#963 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Puppet
Stars
97
Forks
243
Avg merge
8h 17m
Merged PRs (30d)
1

Description

we run puppet agents on a timer here, with runmode => 'systemd.timer'. Yet, when we change environments, for example, we get a flurry of notifications:

Info: Refreshing CRL                                                                                                                                            
Info: CRL is unmodified, using existing CRL                                                                                                                     
Info: Using environment 'puppetnofail'                                                                                                                          
Info: Retrieving pluginfacts                                                                                                                                    
Info: Retrieving plugin                                                                                                                                         
Info: Loading facts                                                                                                                                             
Notice: Requesting catalog from puppet.torproject.org:8140 (204.8.99.151)                                                                                       
Info: Applying configuration version '1759343794'                                                                                                               
Notice: /Stage[main]/Puppet::Config/Concat[/etc/puppet/puppet.conf]/File[/etc/puppet/puppet.conf]/content: 
--- /etc/puppet/puppet.conf     2025-09-15 20:27:03.599437493 +0000                                                                                             
+++ /tmp/puppet-file20251001-585050-rkkjq5      2025-10-01 18:36:43.471870570 +0000  
@@ -16,7 +16,7 @@                                                                                                                                               
 [agent]                                                                                                                                                        
     classfile = $statedir/classes.txt                                                                                                                          
     default_schedules = false                                                                                                                                  
-    environment = production                                                                                                                                   
+    environment = puppetnofail                                                                                                                                 
     include_legacy_facts = true                                                                                                                                
     localconfig = $vardir/localconfig                                                                                                                          
     masterport = 8140                                                                                                                                          
                                        
Notice: /Stage[main]/Puppet::Config/Concat[/etc/puppet/puppet.conf]/File[/etc/puppet/puppet.conf]/content: content changed '{sha256}89d58c841c1b0dec0c3372bd3595
fa70bf4eaf79571695dcc7a8960a9ee10679' to '{sha256}aafd4f00f994044516500daafaaeb9a32ba3855e3b7004241fe0870907899868' (noop)
Notice: /etc/puppet/puppet.conf: Would have triggered 'refresh' from 1 event                                                                                    
Notice: Concat[/etc/puppet/puppet.conf]: Would have triggered 'refresh' from 2 events
Notice: Class[Puppet::Config]: Would have triggered 'refresh' from 1 event
Info: Class[Puppet::Config]: Scheduling refresh of Class[Puppet::Agent::Service]
Notice: Class[Puppet::Agent::Service]: Would have triggered 'refresh' from 1 event
Info: Class[Puppet::Agent::Service]: Scheduling refresh of Class[Puppet::Agent::Service::Daemon]
Info: Class[Puppet::Agent::Service]: Scheduling refresh of Class[Puppet::Agent::Service::Systemd]
Info: Class[Puppet::Agent::Service]: Scheduling refresh of Class[Puppet::Agent::Service::Cron]
Notice: Class[Puppet::Agent::Service::Daemon]: Would have triggered 'refresh' from 1 event
Info: Class[Puppet::Agent::Service::Daemon]: Scheduling refresh of Service[puppet]
Notice: /Stage[main]/Puppet::Agent::Service::Daemon/Service[puppet]: Would have triggered 'refresh' from 1 event
Notice: Class[Puppet::Agent::Service::Daemon]: Would have triggered 'refresh' from 1 event
Notice: Class[Puppet::Agent::Service::Systemd]: Would have triggered 'refresh' from 1 event
Info: Class[Puppet::Agent::Service::Systemd]: Scheduling refresh of Systemd::Timer[puppet-run.timer]
Notice: Systemd::Timer[puppet-run.timer]: Would have triggered 'refresh' from 1 event
Info: Systemd::Timer[puppet-run.timer]: Scheduling refresh of Systemd::Unit_file[puppet-run.service]
Info: Systemd::Timer[puppet-run.timer]: Scheduling refresh of Systemd::Unit_file[puppet-run.timer]
Notice: Class[Puppet::Agent::Service::Cron]: Would have triggered 'refresh' from 1 event
Notice: Systemd::Unit_file[puppet-run.service]: Would have triggered 'refresh' from 1 event
Notice: Systemd::Unit_file[puppet-run.timer]: Would have triggered 'refresh' from 1 event
Info: Systemd::Unit_file[puppet-run.timer]: Scheduling refresh of Service[puppet-run.timer]
Notice: Systemd::Daemon_reload[puppet-run.service]: Would have triggered 'refresh' from 1 event
Info: Systemd::Daemon_reload[puppet-run.service]: Scheduling refresh of Exec[systemd-puppet-run.service-systemctl-daemon-reload]
Notice: /Stage[main]/Puppet::Agent::Service::Systemd/Systemd::Timer[puppet-run.timer]/Systemd::Unit_file[puppet-run.timer]/Service[puppet-run.timer]: Would have triggered 'refresh' from 1 event
Notice: Systemd::Unit_file[puppet-run.timer]: Would have triggered 'refresh' from 1 event
Notice: Systemd::Timer[puppet-run.timer]: Would have triggered 'refresh' from 1 event
Notice: Class[Puppet::Agent::Service::Systemd]: Would have triggered 'refresh' from 1 event
Notice: Class[Puppet::Agent::Service]: Would have triggered 'refresh' from 2 events
Notice: Class[Puppet::Agent]: Would have triggered 'refresh' from 1 event
Notice: Class[Puppet]: Would have triggered 'refresh' from 2 events
Notice: Systemd::Daemon_reload[puppet-run.service]: Would have triggered 'refresh' from 1 event
Notice: Class[Profile::Puppet]: Would have triggered 'refresh' from 1 event
Notice: Stage[main]: Would have triggered 'refresh' from 7 events
Notice: Applied catalog in 3.82 seconds

(i've actually redacted an unrelated event from there which makes counts somewhat off, but the core of the issue is well visible here).

now, some of those changes are of course necessary and expected: we write the environment to the puppet.conf file, so Concat[/etc/puppet/puppet.conf] and its related File fire, that's fine. But Service[puppet]? Class[Puppet::Agent::Service::Daemon]? we don't even run those! Systemd::Unit_file[puppet-run.service], maybe,but we don't actually need (or want!) to reload that service here...

In fact, none of those (but the File resource of course) actually do anything of course... but it makes what is essentially a noop extremely noisy.

i wonder if we could make this line:

  Class['puppet::config', 'puppet::agent::config'] ~> Class['puppet::agent::service']

conditional on the runmode?

a partial workaround for this is to skip some resources, for example this would deactivate the config change altogether on environment changes (which we don't want, we like it to be sticky):

patn --environment puppetnofail --skip_tags puppet::config

and this skips the service class, but not sufficiently to my taste:

patn --environment puppetnofail --skip_tags 'puppet::agent::service'

as it still does that:

Notice: Class[Puppet::Config]: Would have triggered 'refresh' from 1 event
Info: Class[Puppet::Config]: Scheduling refresh of Class[Puppet::Agent::Service]
Info: Class[Puppet::Agent::Service]: Unscheduling all events on Class[Puppet::Agent::Service]
Notice: Systemd::Daemon_reload[puppet-run.service]: Would have triggered 'refresh' from 1 event
Info: Systemd::Daemon_reload[puppet-run.service]: Scheduling refresh of Exec[systemd-puppet-run.service-systemctl-daemon-reload]
Notice: Class[Puppet]: Would have triggered 'refresh' from 1 event
Notice: Systemd::Daemon_reload[puppet-run.service]: Would have triggered 'refresh' from 1 event
Notice: Systemd::Dropin_file[condition-path.conf]: Would have triggered 'refresh' from 2 events
Notice: Class[Profile::Puppet]: Would have triggered 'refresh' from 1 event

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the Class['puppet::config', 'puppet::agent::config'] ~> Class['puppet::agent::service'] relationship and inspect how runmode='systemd.timer' is represented. Trace the related service and Systemd unit resources shown in the report; done means environment changes update puppet.conf without scheduling irrelevant service or unit refreshes for timer mode, while preserving behavior for other runmodes.

Written by the indexing model from the issue text.

Assessment

Domain
devops
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.