I've updated the MP with an important change - reverting from adding a file in /etc/cron.d and instead updating `/etc/crontab` itself. This is because the charm would also need to manage the `/etc/cron.daily/logrotate` file and this would involve changing the system crontab. Since we can't move the logrotate cronjob (provided by the apt package) out from cron.daily, we need to directly modify the time schedule in `/etc/crontab`.
Another important observation is that the `lib_cron.install_cronjob` and `lib_logrotate.modify_configs` are called in 3 situations - install/config changed hook, running an action and from the cronjob itself. In all these three places, the user running the code is root.
I've updated the MP with an important change - reverting from adding a file in /etc/cron.d and instead updating `/etc/crontab` itself. This is because the charm would also need to manage the `/etc/cron. daily/logrotate ` file and this would involve changing the system crontab. Since we can't move the logrotate cronjob (provided by the apt package) out from cron.daily, we need to directly modify the time schedule in `/etc/crontab`.
Another important observation is that the `lib_cron. install_ cronjob` and `lib_logrotate. modify_ configs` are called in 3 situations - install/config changed hook, running an action and from the cronjob itself. In all these three places, the user running the code is root.