2023-01-26 07:31:07 +00:00
|
|
|
import json
|
|
|
|
import logging
|
|
|
|
|
|
|
|
import borgmatic.borg.rinfo
|
|
|
|
import borgmatic.config.validate
|
|
|
|
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
|
|
|
|
|
|
|
def run_rinfo(
|
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,
|
|
|
|
rinfo_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 "rinfo" action for the given repository.
|
|
|
|
|
|
|
|
If rinfo_arguments.json is True, yield the JSON output from the info for the repository.
|
|
|
|
'''
|
|
|
|
if rinfo_arguments.repository is None or borgmatic.config.validate.repositories_match(
|
|
|
|
repository, rinfo_arguments.repository
|
|
|
|
):
|
|
|
|
if not rinfo_arguments.json: # pragma: nocover
|
2023-05-16 16:36:50 +00:00
|
|
|
logger.answer(
|
|
|
|
f'{repository.get("label", repository["path"])}: Displaying repository summary information'
|
|
|
|
)
|
2023-03-24 06:11:14 +00:00
|
|
|
|
2023-01-26 07:31:07 +00:00
|
|
|
json_output = borgmatic.borg.rinfo.display_repository_info(
|
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,
|
|
|
|
rinfo_arguments=rinfo_arguments,
|
2023-05-09 06:00:49 +00:00
|
|
|
global_arguments=global_arguments,
|
2023-01-26 07:31:07 +00:00
|
|
|
local_path=local_path,
|
|
|
|
remote_path=remote_path,
|
|
|
|
)
|
|
|
|
if json_output: # pragma: nocover
|
|
|
|
yield json.loads(json_output)
|