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

config "override" silently accept incomplete override options #32

Closed jneo8 closed 10 months ago

jneo8 commented 10 months ago

The config option "override" will silently accept incomplete "override" options.

In charm-logrotated rev 10, the "override" option accept a JSON formatted string to override the logrotate directives for each file in "/etc/logrotate.d/". The JSON formatted string can be

'[ {"path": "/etc/logrotate.d/rotatefile", "rotate": 5, "interval": "weekly"} ]'

. In this example, this will override directives "rotate" and "interval" "for /etc/logrotate.d/rotatefile". However, if not all "path", "rotate", "interval" are provided, the charm will ignore this config option without warning or error. For example, if one provides the following string to "override":

'[ {"path": "/etc/logrotate.d/rotatefile", "interval": "daily"} ]'

It will not override directive "interval" for "/etc/logrotate.d/rotatefile". I am not sure if this is the expected behavior for this option, at least it is not documented in the config option.

Reference line that causes the issue: https://git.launchpad.net/charm-logrotated/tree/src/lib/lib_logrotate.py#n55


Imported from Launchpad using lp2gh.