|
@@ -39,23 +39,27 @@ def prune_archives(verbosity, dry_run, repository, storage_config, retention_con
|
|
|
retention config dict, prune Borg archives according to the retention policy specified in that
|
|
|
configuration.
|
|
|
'''
|
|
|
- remote_path_flags = ('--remote-path', remote_path) if remote_path else ()
|
|
|
+ umask = storage_config.get('umask', None)
|
|
|
lock_wait = storage_config.get('lock_wait', None)
|
|
|
- lock_wait_flags = ('--lock-wait', str(lock_wait)) if lock_wait else ()
|
|
|
- verbosity_flags = {
|
|
|
- VERBOSITY_SOME: ('--info', '--stats',),
|
|
|
- VERBOSITY_LOTS: ('--debug', '--stats', '--list'),
|
|
|
- }.get(verbosity, ())
|
|
|
- dry_run_flags = ('--dry-run',) if dry_run else ()
|
|
|
|
|
|
full_command = (
|
|
|
- local_path, 'prune',
|
|
|
- repository,
|
|
|
- ) + tuple(
|
|
|
- element
|
|
|
- for pair in _make_prune_flags(retention_config)
|
|
|
- for element in pair
|
|
|
- ) + remote_path_flags + lock_wait_flags + verbosity_flags + dry_run_flags
|
|
|
+ (
|
|
|
+ local_path, 'prune',
|
|
|
+ repository,
|
|
|
+ ) + tuple(
|
|
|
+ element
|
|
|
+ for pair in _make_prune_flags(retention_config)
|
|
|
+ for element in pair
|
|
|
+ )
|
|
|
+ + (('--remote-path', remote_path) if remote_path else ())
|
|
|
+ + (('--umask', str(umask)) if umask else ())
|
|
|
+ + (('--lock-wait', str(lock_wait)) if lock_wait else ())
|
|
|
+ + {
|
|
|
+ VERBOSITY_SOME: ('--info', '--stats',),
|
|
|
+ VERBOSITY_LOTS: ('--debug', '--stats', '--list'),
|
|
|
+ }.get(verbosity, ())
|
|
|
+ + (('--dry-run',) if dry_run else ())
|
|
|
+ )
|
|
|
|
|
|
logger.debug(' '.join(full_command))
|
|
|
subprocess.check_call(full_command)
|