2023-01-26 07:31:07 +00:00
|
|
|
import logging
|
|
|
|
|
|
|
|
import borgmatic.borg.prune
|
2023-03-15 16:39:54 +00:00
|
|
|
import borgmatic.config.validate
|
2023-01-26 07:31:07 +00:00
|
|
|
import borgmatic.hooks.command
|
|
|
|
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
|
|
|
|
|
|
|
def run_prune(
|
|
|
|
config_filename,
|
|
|
|
repository,
|
2023-07-09 06:14:30 +00:00
|
|
|
config,
|
2023-01-26 07:31:07 +00:00
|
|
|
local_borg_version,
|
|
|
|
prune_arguments,
|
|
|
|
global_arguments,
|
|
|
|
dry_run_label,
|
|
|
|
local_path,
|
|
|
|
remote_path,
|
|
|
|
):
|
|
|
|
'''
|
|
|
|
Run the "prune" action for the given repository.
|
|
|
|
'''
|
2023-03-15 16:39:54 +00:00
|
|
|
if prune_arguments.repository and not borgmatic.config.validate.repositories_match(
|
|
|
|
repository, prune_arguments.repository
|
|
|
|
):
|
|
|
|
return
|
|
|
|
|
2025-01-25 22:01:25 +00:00
|
|
|
logger.info(f'Pruning archives{dry_run_label}')
|
2023-01-26 07:31:07 +00:00
|
|
|
borgmatic.borg.prune.prune_archives(
|
|
|
|
global_arguments.dry_run,
|
2023-03-24 19:34:57 +00:00
|
|
|
repository['path'],
|
2023-07-09 06:14:30 +00:00
|
|
|
config,
|
2023-01-26 07:31:07 +00:00
|
|
|
local_borg_version,
|
2023-03-25 20:28:03 +00:00
|
|
|
prune_arguments,
|
2023-05-23 23:55:40 +00:00
|
|
|
global_arguments,
|
2023-01-26 07:31:07 +00:00
|
|
|
local_path=local_path,
|
|
|
|
remote_path=remote_path,
|
|
|
|
)
|