Project

General

Profile

Bug #11624

Cronjob saved as rudder-agent.rpmsave duplicating the job

Added by Janos Mattyasovszky over 2 years ago. Updated about 2 months ago.

Status:
New
Priority:
N/A
Assignee:
-
Category:
Packaging
Target version:
Pull Request:
Severity:
Minor - inconvenience | misleading | easy workaround
User visibility:
Operational - other Techniques | Technique editor | Rudder settings
Effort required:
Small
Priority:
0

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 :-/

#1

Updated by Benoît PECCATTE over 2 years ago

  • User visibility changed from Getting started - demo | first install | level 1 Techniques to Operational - other Techniques | Technique editor | Rudder settings
  • Priority changed from 50 to 32
#2

Updated by Benoît PECCATTE over 2 years ago

  • Effort required set to Small
  • Priority changed from 32 to 36

We could just remove the file during post-install

#3

Updated by Janos Mattyasovszky over 2 years ago

Why keep it in the first place? :)

#4

Updated by Benoît PECCATTE over 2 years ago

  • Priority changed from 36 to 48
#5

Updated by Nicolas CHARLES 9 months ago

  • Target version set to 5.0.13
  • Priority changed from 48 to 0

This is still the case

#6

Updated by Vincent MEMBRÉ 7 months ago

  • Target version changed from 5.0.13 to 5.0.14
#7

Updated by Vincent MEMBRÉ 6 months ago

  • Target version changed from 5.0.14 to 5.0.15
#8

Updated by Vincent MEMBRÉ 4 months ago

  • Target version changed from 5.0.15 to 5.0.16
#9

Updated by Alexis MOUSSET about 2 months ago

  • Target version changed from 5.0.16 to 5.0.17

Also available in: Atom PDF