Fixed remove backups older than

Change-Id: Ifcff9567a09b5e04ce95d0fb48ff2016c8a1dc53
Closes-Bug: 1626190
This commit is contained in:
Saad Zaher 2016-09-21 16:44:01 +00:00
parent 7082f39b6c
commit 368919a0c6
2 changed files with 5 additions and 1 deletions

View File

@ -219,7 +219,7 @@ class AdminJob(Job):
self.conf.hostname_backup_name)
return {}
elif self.conf.remove_older_than:
self.storage.remove_older_than(self.conf.remove_before_date,
self.storage.remove_older_than(self.conf.remove_older_than,
self.conf.hostname_backup_name)
return {}

View File

@ -145,6 +145,10 @@ class Storage(object):
:type remove_older_timestamp: int
:type hostname_backup_name: str
"""
LOG.info('Removing backups older than {0} for {1}'.format(
remove_older_timestamp,
hostname_backup_name
))
backups = self.find_all(hostname_backup_name)
backups = [b for b in backups
if b.latest_update.timestamp <= remove_older_timestamp]