ubuntu-repository-cache fails to sync because its logs file does not exist

Bug #1672669 reported by Junien F
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
ubuntu-repository-cache (Juju Charms Collection)
Fix Committed
Critical
Chris Glass

Bug Description

Hi,

We redeployed some environments with the latest ubuntu-repository-cache today, and noticed that the cron job fails to start because the log file does not exist.

The cron job is :

ubuntu@machine-1:~$ cat /etc/cron.d/ubuntu-repository-cache_rsync
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
LOCAL_UNIT=ubuntu-repository-cache/1
APACHE_ROOT=/srv/ubuntu-repository-cache/ephemeral/0/apache
SYNC_HOST=archive.ubuntu.com
UNIT_PATH=unit-ubuntu-repository-cache-1
# This cronjob will make the leader sync its view of the metadata with upstream
# It will then trigger a juju-run to let its peers synchronise.
59 * * * * www-sync python3 /var/lib/juju/agents/unit-ubuntu-repository-cache-1/charm/lib/ubuntu_repository_cache/metadata_sync.py >> /var/log/repository-sync-cron.log

and the /var/log/repository-sync-cron.log doesn't exist. For now, I created it manually on all impacted units and chowned it to www-sync, but a proper fix needs to be implemented.

We should probably :
 * create a dedicated directory in /var/log, with the proper permissions, and log there
 * timestamp the logs
 * rotate them

The last 2 items can be handled by e.g. Python logging using https://docs.python.org/3/library/logging.handlers.html#timedrotatingfilehandler

Chris Glass (tribaal)
Changed in ubuntu-repository-cache (Juju Charms Collection):
status: New → Fix Committed
assignee: nobody → Chris Glass (tribaal)
importance: Undecided → Critical
tags: added: id-58c7fa141bf78a59b1f110d6
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.