canonical / charm-logrotated

logrotate is a subordinate charm that ensure that all logrotate.d configurations within /etc/logrotate.d/ folder are modified accordingly to a retention period defined in the charm
Other
0 stars 2 forks source link

Should perform sanity checks for "override" option #23

Open jneo8 opened 10 months ago

jneo8 commented 10 months ago

Currently, "override" option allows one to change "rotate" and "interval" directives to any value, it's not desired.

One could easily set "rotate" and "interval" to invalid value such as "rotate = -5" or "interval = decade" without problems. However, if one want to change them back to original value, then it's impossible. This is mainly because the charm uses regex to change these values [1,2].

/var/log/apt/term.log {
  rotate -5
  decade
  compress
  missingok
  notifempty
    rotate 5
}
/var/log/apt/history.log {
  rotate -5
  decade
  compress
  missingok
  notifempty
    rotate 5
}

[1] https://git.launchpad.net/charm-logrotated/tree/src/lib/lib_logrotate.py#n17 [2] https://git.launchpad.net/charm-logrotated/tree/src/lib/lib_logrotate.py#n90


Imported from Launchpad using lp2gh.