2023-01-26 07:31:07 +00:00
|
|
|
import logging
|
|
|
|
|
|
|
|
import borgmatic.borg.borg
|
|
|
|
import borgmatic.borg.rlist
|
|
|
|
import borgmatic.config.validate
|
|
|
|
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
|
|
|
|
|
|
|
def run_borg(
|
2023-04-15 02:35:24 +00:00
|
|
|
repository,
|
2023-07-09 06:14:30 +00:00
|
|
|
config,
|
2023-04-15 02:35:24 +00:00
|
|
|
local_borg_version,
|
|
|
|
borg_arguments,
|
2023-05-09 06:00:49 +00:00
|
|
|
global_arguments,
|
2023-04-15 02:35:24 +00:00
|
|
|
local_path,
|
|
|
|
remote_path,
|
2023-01-26 07:31:07 +00:00
|
|
|
):
|
|
|
|
'''
|
|
|
|
Run the "borg" action for the given repository.
|
|
|
|
'''
|
|
|
|
if borg_arguments.repository is None or borgmatic.config.validate.repositories_match(
|
|
|
|
repository, borg_arguments.repository
|
|
|
|
):
|
2023-05-16 16:36:50 +00:00
|
|
|
logger.info(
|
|
|
|
f'{repository.get("label", repository["path"])}: Running arbitrary Borg command'
|
|
|
|
)
|
2023-01-26 07:31:07 +00:00
|
|
|
archive_name = borgmatic.borg.rlist.resolve_archive_name(
|
2023-03-24 19:34:57 +00:00
|
|
|
repository['path'],
|
2023-01-26 07:31:07 +00:00
|
|
|
borg_arguments.archive,
|
2023-07-09 06:14:30 +00:00
|
|
|
config,
|
2023-01-26 07:31:07 +00:00
|
|
|
local_borg_version,
|
2023-05-09 06:00:49 +00:00
|
|
|
global_arguments,
|
2023-01-26 07:31:07 +00:00
|
|
|
local_path,
|
|
|
|
remote_path,
|
|
|
|
)
|
|
|
|
borgmatic.borg.borg.run_arbitrary_borg(
|
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,
|
|
|
|
options=borg_arguments.options,
|
|
|
|
archive=archive_name,
|
|
|
|
local_path=local_path,
|
|
|
|
remote_path=remote_path,
|
|
|
|
)
|