Merge pull request #944 from ThomasWaldmann/fix-942

prune: fix bad validator, fixes #942
This commit is contained in:
TW 2016-04-19 00:50:45 +02:00
commit 3060332f06
1 changed files with 6 additions and 4 deletions

View File

@ -565,11 +565,13 @@ class Archiver:
@with_repository() @with_repository()
def do_prune(self, args, repository, manifest, key): def do_prune(self, args, repository, manifest, key):
"""Prune repository archives according to specified rules""" """Prune repository archives according to specified rules"""
archives = manifest.list_archive_infos(sort_by='ts', reverse=True) # just a ArchiveInfo list if not any((args.hourly, args.daily,
if args.hourly + args.daily + args.weekly + args.monthly + args.yearly == 0 and args.within is None: args.weekly, args.monthly, args.yearly, args.within)):
self.print_error('At least one of the "keep-within", "keep-hourly", "keep-daily", "keep-weekly", ' self.print_error('At least one of the "keep-within", "keep-last", '
'"keep-monthly" or "keep-yearly" settings must be specified') '"keep-hourly", "keep-daily", '
'"keep-weekly", "keep-monthly" or "keep-yearly" settings must be specified.')
return self.exit_code return self.exit_code
archives = manifest.list_archive_infos(sort_by='ts', reverse=True) # just a ArchiveInfo list
if args.prefix: if args.prefix:
archives = [archive for archive in archives if archive.name.startswith(args.prefix)] archives = [archive for archive in archives if archive.name.startswith(args.prefix)]
keep = [] keep = []