Project

General

Profile

Actions

Bug #11624

closed

Cronjob saved as rudder-agent.rpmsave duplicating the job

Added by Janos Mattyasovszky about 7 years ago. Updated almost 3 years ago.

Status:
Resolved
Priority:
N/A
Assignee:
-
Category:
Packaging
Target version:
Severity:
Minor - inconvenience | misleading | easy workaround
UX impact:
User visibility:
Operational - other Techniques | Technique editor | Rudder settings
Effort required:
Small
Priority:
0
Name check:
Fix check:
Regression:

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:

https://github.com/Normation/rudder-packages/blob/378bcb3b982be49aa1a249044db4edb8661685e3/rudder-agent/SPECS/rudder-agent.spec#L478

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:

https://github.com/Normation/rudder-techniques/blame/master/techniques/system/common/1.0/rudder-agent-community-cron

https://github.com/Normation/rudder-techniques/blob/7c1fc1f763ea2bf5ba67df6e8d2d28bd7fcae57d/techniques/system/common/1.0/cron-setup.st#L35

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
  1. If there was no agent installed before, there is no file that needs to be kept
  2. If there was an agent which was never connected to a policy server, it does not really matter, does it?
  3. 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 :-/

Actions

Also available in: Atom PDF