canonical / juju-backup-all

Tool for backing up charms, local juju configs, and juju controllers.
Apache License 2.0
0 stars 5 forks source link

traceback in purge_old_backups #14

Open zxhdaze opened 7 months ago

zxhdaze commented 7 months ago

When purge old backups, traceback happened in /var/lib/jujubackupall/auto_backup.py.

The command tried to find all files including directory older than 30days and delete them. I think it should only delete files under '/opt/backups' (excluding directories). Should the command look like something as "find /opt/backups -mtime +30 -type f -delete"?

sudo -u nagios /usr/local/lib/nagios/plugins/check_auto_backup_results.py --backup-results-file /var/lib/jujubackupall/auto_backup_results.json

CRITICAL: Detected error when performing backup: 'Traceback (most recent call last): File "/var/lib/jujubackupall/auto_backup.py", line 133, in run self.purge_old_backups(args.purge_after_days) File "/var/lib/jujubackupall/auto_backup.py", line 86, in purge_old_backups subprocess.check_output(cmd) File "/usr/lib/python3.8/subprocess.py", line 415, in check_output return run(*popenargs, stdout=PIPE, timeout=timeout, check=True, File "/usr/lib/python3.8/subprocess.py", line 516, in run raise CalledProcessError(retcode, process.args, subprocess.CalledProcessError: Command '['find', '/opt/backups', '-mtime', '+30', '-delete']' returned non-zero exit status 1. '

sudo -u jujubackup find /opt/backups -mtime +30 -delete

find: cannot delete ‘/opt/backups/foundations-maas/openstack’: Directory not empty find: cannot delete ‘/opt/backups’: Permission denied


Imported from Launchpad using lp2gh.