Bug #11624
closedCronjob saved as rudder-agent.rpmsave duplicating the job
Description
If someone has local modifications to the rudder cronjob, the update keeps the old version in the same directory:
warning: /etc/cron.d/rudder-agent saved as /etc/cron.d/rudder-agent.rpmsave
Now duplicated:
# ll /etc/cron.d/rudder-agent* -rw-r--r-- 1 root root 381 Sep 7 12:10 /etc/cron.d/rudder-agent -rw-r--r-- 1 root root 495 Oct 13 17:41 /etc/cron.d/rudder-agent.rpmsave
It's because the cronjob is declared as %config
in the spec file:
Not sure if this is the best way to do that... Also not sure if cron does actually ignore *.rpmsave
files, but I currently don't know for sure.
As soon you change your rudder cron technique and that changes the file on disk, any agent update having a different file for cron than that will duplicate the file and keep the old indefinite, since you also might change that file from within the policy itself:
My humble recommendation would be to remove the%config
directive, since the resulting on-disk cron file will be replaced by the first received policy anyway, there is no real benefit from keeping local modifications because
- If there was no agent installed before, there is no file that needs to be kept
- If there was an agent which was never connected to a policy server, it does not really matter, does it?
- If there was an agent which was executing policy, it has templated that file anyway, so no local modification was ever kept, all mods need to go to the root server's
techniques/system/common/1.0/rudder-agent-community-cron
file...
You might even consider removing either that file from the agent's rpm or have a different cronjob being templated, since modifying files that are owned by an rpm causes the headache :-/