use repository["path"] instead of repository

This commit is contained in:
Divyansh Singh 2023-03-25 01:04:57 +05:30
parent 7a2f287918
commit e83ad9e1e4
36 changed files with 193 additions and 134 deletions

View File

@ -16,9 +16,9 @@ def run_borg(
if borg_arguments.repository is None or borgmatic.config.validate.repositories_match(
repository, borg_arguments.repository
):
logger.info('{}: Running arbitrary Borg command'.format(repository))
logger.info('{}: Running arbitrary Borg command'.format(repository['path']))
archive_name = borgmatic.borg.rlist.resolve_archive_name(
repository,
repository['path'],
borg_arguments.archive,
storage,
local_borg_version,
@ -26,7 +26,7 @@ def run_borg(
remote_path,
)
borgmatic.borg.borg.run_arbitrary_borg(
repository,
repository['path'],
storage,
local_borg_version,
options=borg_arguments.options,

View File

@ -15,7 +15,11 @@ def run_break_lock(
if break_lock_arguments.repository is None or borgmatic.config.validate.repositories_match(
repository, break_lock_arguments.repository
):
logger.info(f'{repository}: Breaking repository and cache locks')
logger.info(f'{repository["path"]}: Breaking repository and cache locks')
borgmatic.borg.break_lock.break_lock(
repository, storage, local_borg_version, local_path=local_path, remote_path=remote_path,
repository['path'],
storage,
local_borg_version,
local_path=local_path,
remote_path=remote_path,
)

View File

@ -37,9 +37,9 @@ def run_check(
global_arguments.dry_run,
**hook_context,
)
logger.info('{}: Running consistency checks'.format(repository))
logger.info('{}: Running consistency checks'.format(repository['path']))
borgmatic.borg.check.check_archives(
repository,
repository['path'],
location,
storage,
consistency,

View File

@ -39,10 +39,10 @@ def run_compact(
**hook_context,
)
if borgmatic.borg.feature.available(borgmatic.borg.feature.Feature.COMPACT, local_borg_version):
logger.info('{}: Compacting segments{}'.format(repository, dry_run_label))
logger.info('{}: Compacting segments{}'.format(repository['path'], dry_run_label))
borgmatic.borg.compact.compact_segments(
global_arguments.dry_run,
repository,
repository['path'],
storage,
local_borg_version,
local_path=local_path,
@ -52,7 +52,9 @@ def run_compact(
threshold=compact_arguments.threshold,
)
else: # pragma: nocover
logger.info('{}: Skipping compact (only available/needed in Borg 1.2+)'.format(repository))
logger.info(
'{}: Skipping compact (only available/needed in Borg 1.2+)'.format(repository['path'])
)
borgmatic.hooks.command.execute_hook(
hooks.get('after_compact'),
hooks.get('umask'),

View File

@ -23,13 +23,15 @@ def run_export_tar(
repository, export_tar_arguments.repository
):
logger.info(
'{}: Exporting archive {} as tar file'.format(repository, export_tar_arguments.archive)
'{}: Exporting archive {} as tar file'.format(
repository['path'], export_tar_arguments.archive
)
)
borgmatic.borg.export_tar.export_tar_archive(
global_arguments.dry_run,
repository,
repository['path'],
borgmatic.borg.rlist.resolve_archive_name(
repository,
repository['path'],
export_tar_arguments.archive,
storage,
local_borg_version,

View File

@ -35,12 +35,14 @@ def run_extract(
if extract_arguments.repository is None or borgmatic.config.validate.repositories_match(
repository, extract_arguments.repository
):
logger.info('{}: Extracting archive {}'.format(repository, extract_arguments.archive))
logger.info(
'{}: Extracting archive {}'.format(repository['path'], extract_arguments.archive)
)
borgmatic.borg.extract.extract_archive(
global_arguments.dry_run,
repository,
repository['path'],
borgmatic.borg.rlist.resolve_archive_name(
repository,
repository['path'],
extract_arguments.archive,
storage,
local_borg_version,

View File

@ -20,9 +20,9 @@ def run_info(
repository, info_arguments.repository
):
if not info_arguments.json: # pragma: nocover
logger.answer(f'{repository}: Displaying archive summary information')
logger.answer(f'{repository["path"]}: Displaying archive summary information')
info_arguments.archive = borgmatic.borg.rlist.resolve_archive_name(
repository,
repository['path'],
info_arguments.archive,
storage,
local_borg_version,
@ -30,7 +30,7 @@ def run_info(
remote_path,
)
json_output = borgmatic.borg.info.display_archives_info(
repository,
repository['path'],
storage,
local_borg_version,
info_arguments=info_arguments,

View File

@ -20,11 +20,11 @@ def run_list(
):
if not list_arguments.json: # pragma: nocover
if list_arguments.find_paths:
logger.answer(f'{repository}: Searching archives')
logger.answer(f'{repository["path"]}: Searching archives')
elif not list_arguments.archive:
logger.answer(f'{repository}: Listing archives')
logger.answer(f'{repository["path"]}: Listing archives')
list_arguments.archive = borgmatic.borg.rlist.resolve_archive_name(
repository,
repository['path'],
list_arguments.archive,
storage,
local_borg_version,
@ -32,7 +32,7 @@ def run_list(
remote_path,
)
json_output = borgmatic.borg.list.list_archive(
repository,
repository['path'],
storage,
local_borg_version,
list_arguments=list_arguments,

View File

@ -17,14 +17,16 @@ def run_mount(
repository, mount_arguments.repository
):
if mount_arguments.archive:
logger.info('{}: Mounting archive {}'.format(repository, mount_arguments.archive))
logger.info(
'{}: Mounting archive {}'.format(repository['path'], mount_arguments.archive)
)
else: # pragma: nocover
logger.info('{}: Mounting repository'.format(repository))
logger.info('{}: Mounting repository'.format(repository['path']))
borgmatic.borg.mount.mount_archive(
repository,
repository['path'],
borgmatic.borg.rlist.resolve_archive_name(
repository,
repository['path'],
mount_arguments.archive,
storage,
local_borg_version,

View File

@ -37,10 +37,10 @@ def run_prune(
global_arguments.dry_run,
**hook_context,
)
logger.info('{}: Pruning archives{}'.format(repository, dry_run_label))
logger.info('{}: Pruning archives{}'.format(repository['path'], dry_run_label))
borgmatic.borg.prune.prune_archives(
global_arguments.dry_run,
repository,
repository['path'],
storage,
retention,
local_borg_version,

View File

@ -23,10 +23,10 @@ def run_rcreate(
):
return
logger.info('{}: Creating repository'.format(repository))
logger.info('{}: Creating repository'.format(repository['path']))
borgmatic.borg.rcreate.create_repository(
global_arguments.dry_run,
repository,
repository['path'],
storage,
local_borg_version,
rcreate_arguments.encryption_mode,

View File

@ -256,22 +256,35 @@ def run_restore(
return
logger.info(
'{}: Restoring databases from archive {}'.format(repository, restore_arguments.archive)
'{}: Restoring databases from archive {}'.format(
repository['path'], restore_arguments.archive
)
)
borgmatic.hooks.dispatch.call_hooks_even_if_unconfigured(
'remove_database_dumps',
hooks,
repository,
repository['path'],
borgmatic.hooks.dump.DATABASE_HOOK_NAMES,
location,
global_arguments.dry_run,
)
archive_name = borgmatic.borg.rlist.resolve_archive_name(
repository, restore_arguments.archive, storage, local_borg_version, local_path, remote_path,
repository['path'],
restore_arguments.archive,
storage,
local_borg_version,
local_path,
remote_path,
)
archive_database_names = collect_archive_database_names(
repository, archive_name, location, storage, local_borg_version, local_path, remote_path,
repository['path'],
archive_name,
location,
storage,
local_borg_version,
local_path,
remote_path,
)
restore_names = find_databases_to_restore(restore_arguments.databases, archive_database_names)
found_names = set()
@ -291,7 +304,7 @@ def run_restore(
found_names.add(database_name)
restore_single_database(
repository,
repository['path'],
location,
storage,
hooks,
@ -320,7 +333,7 @@ def run_restore(
database['name'] = database_name
restore_single_database(
repository,
repository['path'],
location,
storage,
hooks,
@ -336,7 +349,7 @@ def run_restore(
borgmatic.hooks.dispatch.call_hooks_even_if_unconfigured(
'remove_database_dumps',
hooks,
repository,
repository['path'],
borgmatic.hooks.dump.DATABASE_HOOK_NAMES,
location,
global_arguments.dry_run,

View File

@ -19,9 +19,11 @@ def run_rinfo(
repository, rinfo_arguments.repository
):
if not rinfo_arguments.json: # pragma: nocover
logger.answer('{}: Displaying repository summary information'.format(repository))
logger.answer(
'{}: Displaying repository summary information'.format(repository['path'])
)
json_output = borgmatic.borg.rinfo.display_repository_info(
repository,
repository['path'],
storage,
local_borg_version,
rinfo_arguments=rinfo_arguments,

View File

@ -19,9 +19,9 @@ def run_rlist(
repository, rlist_arguments.repository
):
if not rlist_arguments.json: # pragma: nocover
logger.answer('{}: Listing repository'.format(repository))
logger.answer('{}: Listing repository'.format(repository['path']))
json_output = borgmatic.borg.rlist.list_repository(
repository,
repository['path'],
storage,
local_borg_version,
rlist_arguments=rlist_arguments,

View File

@ -109,6 +109,8 @@ def run_configuration(config_filename, config, arguments):
while not repo_queue.empty():
repository, retry_num = repo_queue.get()
if isinstance(repository, str):
repository = {'path': repository}
timeout = retry_num * retry_wait
if timeout:
logger.warning(f'{config_filename}: Sleeping {timeout}s before next retry')
@ -263,6 +265,8 @@ def run_actions(
invalid.
'''
add_custom_log_levels()
if isinstance(repository, str):
repository = {'path': repository}
repository_path = os.path.expanduser(repository['path'])
global_arguments = arguments['global']
dry_run_label = ' (dry run; not making any changes)' if global_arguments.dry_run else ''

View File

@ -56,14 +56,16 @@ def normalize(config_filename, config):
# Upgrade remote repositories to ssh:// syntax, required in Borg 2.
repositories = location.get('repositories')
if isinstance(repositories[0], str):
config['location']['repositories'] = [{'path': repository} for repository in repositories]
repositories = config['location']['repositories']
if repositories:
if isinstance(repositories[0], str):
config['location']['repositories'] = [
{'path': repository} for repository in repositories
]
repositories = config['location']['repositories']
config['location']['repositories'] = []
for repository_dict in repositories:
repository = repository_dict['path']
if '~' in repository:
repository_path = repository_dict['path']
if '~' in repository_path:
logs.append(
logging.makeLogRecord(
dict(
@ -73,37 +75,42 @@ def normalize(config_filename, config):
)
)
)
if ':' in repository:
if repository.startswith('file://'):
updated_repository_path = os.path.abspath(repository.partition('file://')[-1])
if ':' in repository_path:
if repository_path.startswith('file://'):
updated_repository_path = os.path.abspath(
repository_path.partition('file://')[-1]
)
config['location']['repositories'].append(
{
'path': updated_repository_path,
'label': repository_dict.get('label', None),
'label': repository_dict.get('label', ''),
}
)
elif repository.startswith('ssh://'):
elif repository_path.startswith('ssh://'):
config['location']['repositories'].append(
{'path': repository, 'label': repository_dict.get('label', None),}
{'path': repository_path, 'label': repository_dict.get('label', '')}
)
else:
rewritten_repository = f"ssh://{repository.replace(':~', '/~').replace(':/', '/').replace(':', '/./')}"
rewritten_repository_path = f"ssh://{repository_path.replace(':~', '/~').replace(':/', '/').replace(':', '/./')}"
logs.append(
logging.makeLogRecord(
dict(
levelno=logging.WARNING,
levelname='WARNING',
msg=f'{config_filename}: Remote repository paths without ssh:// syntax are deprecated. Interpreting "{repository}" as "{rewritten_repository}"',
msg=f'{config_filename}: Remote repository paths without ssh:// syntax are deprecated. Interpreting "{repository_path}" as "{rewritten_repository_path}"',
)
)
)
config['location']['repositories'].append(
{'path': rewritten_repository, 'label': repository_dict.get('label', None),}
{
'path': rewritten_repository_path,
'label': repository_dict.get('label', ''),
}
)
else:
config['location']['repositories'].append(
{'path': repository, 'label': repository_dict.get('label', None),}
{'path': repository_path, 'label': repository_dict.get('label', '')}
)
return logs

View File

@ -36,23 +36,33 @@ properties:
path:
type: string
description: |
Path to local or remote repository (required).
are expanded. Multiple repositories are backed up to
in sequence. Borg placeholders can be used. See the
output of "borg help placeholders" for details. See
ssh_command for SSH options like identity file or
port. If systemd service is used, then add local
repository paths in the systemd service file to the
ReadWritePaths list.
example:
- ssh://user@backupserver/./sourcehostname.borg
- ssh://user@backupserver/./{fqdn}
- /var/local/backups/local.borg
Path to local or remote repository
(required). Tildes are expanded.
Multiple repositories are backed up
to in sequence. Borg placeholders
can be used. See the output of
"borg help placeholders" for
details. See ssh_command for SSH
options like identity file or port.
If systemd service is used, then
add local repository paths in the
systemd service file to the
ReadWritePaths list.
example: ssh://user@backupserver/./{fqdn}
label:
type: string
description: |
Optional label for the repository.
Optional label for the repository. This
can be used with the --repository option
to select a repository to backup to.
If not specified, the repository path is
used as the label.
example: backupserver
example:
- path: ssh://user@backupserver/./{fqdn}
label: backupserver
- path: /mnt/backup
label: local
working_directory:
type: string
description: |

View File

@ -141,12 +141,14 @@ def repositories_match(first, second):
Given two repository dicts with keys 'path' (relative and/or absolute),
and 'label', return whether they match.
'''
if isinstance(first, str) and isinstance(second, str):
return normalize_repository_path(first) == normalize_repository_path(second)
elif isinstance(first, dict) and isinstance(second, str):
return (second == first.get('label')) or (
normalize_repository_path(second) == normalize_repository_path(first.get('path'))
)
if isinstance(first, str):
first = {'path': first, 'label': first}
if isinstance(second, str):
second = {'path': second, 'label': second}
return (first.get('label') == second.get('label')) or (
normalize_repository_path(first.get('path'))
== normalize_repository_path(second.get('path'))
)
def guard_configuration_contains_repository(repository, configurations):

View File

@ -63,7 +63,10 @@ def test_parse_configuration_transforms_file_into_mapping():
config, logs = module.parse_configuration('/tmp/config.yaml', '/tmp/schema.yaml')
assert config == {
'location': {'source_directories': ['/home', '/etc'], 'repositories': ['hostname.borg']},
'location': {
'source_directories': ['/home', '/etc'],
'repositories': [{'path': 'hostname.borg', 'label': ''}],
},
'retention': {'keep_daily': 7, 'keep_hourly': 24, 'keep_minutely': 60},
'consistency': {'checks': [{'name': 'repository'}, {'name': 'archives'}]},
}
@ -89,7 +92,7 @@ def test_parse_configuration_passes_through_quoted_punctuation():
assert config == {
'location': {
'source_directories': [f'/home/{string.punctuation}'],
'repositories': ['test.borg'],
'repositories': [{'path': 'test.borg', 'label': ''}],
}
}
assert logs == []
@ -151,7 +154,10 @@ def test_parse_configuration_inlines_include():
config, logs = module.parse_configuration('/tmp/config.yaml', '/tmp/schema.yaml')
assert config == {
'location': {'source_directories': ['/home'], 'repositories': ['hostname.borg']},
'location': {
'source_directories': ['/home'],
'repositories': [{'path': 'hostname.borg', 'label': ''}],
},
'retention': {'keep_daily': 7, 'keep_hourly': 24},
}
assert logs == []
@ -185,7 +191,10 @@ def test_parse_configuration_merges_include():
config, logs = module.parse_configuration('/tmp/config.yaml', '/tmp/schema.yaml')
assert config == {
'location': {'source_directories': ['/home'], 'repositories': ['hostname.borg']},
'location': {
'source_directories': ['/home'],
'repositories': [{'path': 'hostname.borg', 'label': ''}],
},
'retention': {'keep_daily': 1, 'keep_hourly': 24},
}
assert logs == []
@ -247,7 +256,7 @@ def test_parse_configuration_applies_overrides():
assert config == {
'location': {
'source_directories': ['/home'],
'repositories': ['hostname.borg'],
'repositories': [{'path': 'hostname.borg', 'label': ''}],
'local_path': 'borg2',
}
}
@ -273,7 +282,7 @@ def test_parse_configuration_applies_normalization():
assert config == {
'location': {
'source_directories': ['/home'],
'repositories': ['hostname.borg'],
'repositories': [{'path': 'hostname.borg', 'label': ''}],
'exclude_if_present': ['.nobackup'],
}
}

View File

@ -13,7 +13,7 @@ def test_run_borg_does_not_raise():
borg_arguments = flexmock(repository=flexmock(), archive=flexmock(), options=flexmock())
module.run_borg(
repository='repo',
repository={'path': 'repos'},
storage={},
local_borg_version=None,
borg_arguments=borg_arguments,

View File

@ -10,7 +10,7 @@ def test_run_break_lock_does_not_raise():
break_lock_arguments = flexmock(repository=flexmock())
module.run_break_lock(
repository='repo',
repository={'path': 'repo'},
storage={},
local_borg_version=None,
break_lock_arguments=break_lock_arguments,

View File

@ -18,7 +18,7 @@ def test_run_check_calls_hooks_for_configured_repository():
module.run_check(
config_filename='test.yaml',
repository='repo',
repository={'path': 'repo'},
location={'repositories': ['repo']},
storage={},
consistency={},
@ -49,7 +49,7 @@ def test_run_check_runs_with_selected_repository():
module.run_check(
config_filename='test.yaml',
repository=flexmock(),
repository={'path': 'repo'},
location={'repositories': ['repo']},
storage={},
consistency={},
@ -80,7 +80,7 @@ def test_run_check_bails_if_repository_does_not_match():
module.run_check(
config_filename='test.yaml',
repository='repo',
repository={'path': 'repo'},
location={'repositories': ['repo']},
storage={},
consistency={},

View File

@ -16,7 +16,7 @@ def test_compact_actions_calls_hooks_for_configured_repository():
module.run_compact(
config_filename='test.yaml',
repository='repo',
repository={'path': 'repo'},
storage={},
retention={},
hooks={},
@ -44,7 +44,7 @@ def test_compact_runs_with_selected_repository():
module.run_compact(
config_filename='test.yaml',
repository='repo',
repository={'path': 'repo'},
storage={},
retention={},
hooks={},
@ -72,7 +72,7 @@ def test_compact_bails_if_repository_does_not_match():
module.run_compact(
config_filename='test.yaml',
repository='repo',
repository={'path': 'repo'},
storage={},
retention={},
hooks={},

View File

@ -24,7 +24,7 @@ def test_run_create_executes_and_calls_hooks_for_configured_repository():
list(
module.run_create(
config_filename='test.yaml',
repository='repo',
repository={'path': 'repo'},
location={},
storage={},
hooks={},
@ -57,7 +57,7 @@ def test_run_create_runs_with_selected_repository():
list(
module.run_create(
config_filename='test.yaml',
repository='repo',
repository={'path': 'repo'},
location={},
storage={},
hooks={},

View File

@ -19,7 +19,7 @@ def test_run_export_tar_does_not_raise():
global_arguments = flexmock(monitoring_verbosity=1, dry_run=False)
module.run_export_tar(
repository='repo',
repository={'path': 'repo'},
storage={},
local_borg_version=None,
export_tar_arguments=export_tar_arguments,

View File

@ -20,7 +20,7 @@ def test_run_extract_calls_hooks():
module.run_extract(
config_filename='test.yaml',
repository='repo',
repository={'path': 'repo'},
location={'repositories': ['repo']},
storage={},
hooks={},

View File

@ -14,7 +14,7 @@ def test_run_info_does_not_raise():
list(
module.run_info(
repository='repo',
repository={'path': 'repo'},
storage={},
local_borg_version=None,
info_arguments=info_arguments,

View File

@ -14,7 +14,7 @@ def test_run_list_does_not_raise():
list(
module.run_list(
repository='repo',
repository={'path': 'repo'},
storage={},
local_borg_version=None,
list_arguments=list_arguments,

View File

@ -17,7 +17,7 @@ def test_run_mount_does_not_raise():
)
module.run_mount(
repository='repo',
repository={'path': 'repo'},
storage={},
local_borg_version=None,
mount_arguments=mount_arguments,

View File

@ -13,7 +13,7 @@ def test_run_prune_calls_hooks_for_configured_repository():
module.run_prune(
config_filename='test.yaml',
repository='repo',
repository={'path': 'repo'},
storage={},
retention={},
hooks={},
@ -38,7 +38,7 @@ def test_run_prune_runs_with_selected_repository():
module.run_prune(
config_filename='test.yaml',
repository='repo',
repository={'path': 'repo'},
storage={},
retention={},
hooks={},

View File

@ -18,7 +18,7 @@ def test_run_rcreate_does_not_raise():
)
module.run_rcreate(
repository='repo',
repository={'path': 'repo'},
storage={},
local_borg_version=None,
rcreate_arguments=arguments,
@ -45,7 +45,7 @@ def test_run_rcreate_bails_if_repository_does_not_match():
)
module.run_rcreate(
repository='repo',
repository={'path': 'repo'},
storage={},
local_borg_version=None,
rcreate_arguments=arguments,

View File

@ -67,7 +67,7 @@ def test_collect_archive_database_names_parses_archive_paths():
)
archive_database_names = module.collect_archive_database_names(
repository='repo',
repository={'path': 'repo'},
archive='archive',
location={'borgmatic_source_directory': '.borgmatic'},
storage=flexmock(),
@ -92,7 +92,7 @@ def test_collect_archive_database_names_parses_directory_format_archive_paths():
)
archive_database_names = module.collect_archive_database_names(
repository='repo',
repository={'path': 'repo'},
archive='archive',
location={'borgmatic_source_directory': '.borgmatic'},
storage=flexmock(),
@ -113,7 +113,7 @@ def test_collect_archive_database_names_skips_bad_archive_paths():
)
archive_database_names = module.collect_archive_database_names(
repository='repo',
repository={'path': 'repo'},
archive='archive',
location={'borgmatic_source_directory': '.borgmatic'},
storage=flexmock(),
@ -251,7 +251,7 @@ def test_run_restore_restores_each_database():
flexmock(module).should_receive('ensure_databases_found')
module.run_restore(
repository='repo',
repository={'path': 'repo'},
location=flexmock(),
storage=flexmock(),
hooks=flexmock(),
@ -273,7 +273,7 @@ def test_run_restore_bails_for_non_matching_repository():
flexmock(module).should_receive('restore_single_database').never()
module.run_restore(
repository='repo',
repository={'path': 'repo'},
location=flexmock(),
storage=flexmock(),
hooks=flexmock(),
@ -345,7 +345,7 @@ def test_run_restore_restores_database_configured_with_all_name():
flexmock(module).should_receive('ensure_databases_found')
module.run_restore(
repository='repo',
repository={'path': 'repo'},
location=flexmock(),
storage=flexmock(),
hooks=flexmock(),
@ -417,7 +417,7 @@ def test_run_restore_skips_missing_database():
flexmock(module).should_receive('ensure_databases_found')
module.run_restore(
repository='repo',
repository={'path': 'repo'},
location=flexmock(),
storage=flexmock(),
hooks=flexmock(),
@ -483,7 +483,7 @@ def test_run_restore_restores_databases_from_different_hooks():
flexmock(module).should_receive('ensure_databases_found')
module.run_restore(
repository='repo',
repository={'path': 'repo'},
location=flexmock(),
storage=flexmock(),
hooks=flexmock(),

View File

@ -11,7 +11,7 @@ def test_run_rinfo_does_not_raise():
list(
module.run_rinfo(
repository='repo',
repository={'path': 'repo'},
storage={},
local_borg_version=None,
rinfo_arguments=rinfo_arguments,

View File

@ -11,7 +11,7 @@ def test_run_rlist_does_not_raise():
list(
module.run_rlist(
repository='repo',
repository={'path': 'repo'},
storage={},
local_borg_version=None,
rlist_arguments=rlist_arguments,

View File

@ -409,7 +409,7 @@ def test_run_actions_runs_rcreate():
local_path=flexmock(),
remote_path=flexmock(),
local_borg_version=flexmock(),
repository_path='repo',
repository='repo',
)
)
@ -431,7 +431,7 @@ def test_run_actions_runs_transfer():
local_path=flexmock(),
remote_path=flexmock(),
local_borg_version=flexmock(),
repository_path='repo',
repository='repo',
)
)
@ -454,7 +454,7 @@ def test_run_actions_runs_create():
local_path=flexmock(),
remote_path=flexmock(),
local_borg_version=flexmock(),
repository_path='repo',
repository='repo',
)
)
assert result == (expected,)
@ -477,7 +477,7 @@ def test_run_actions_runs_prune():
local_path=flexmock(),
remote_path=flexmock(),
local_borg_version=flexmock(),
repository_path='repo',
repository='repo',
)
)
@ -499,7 +499,7 @@ def test_run_actions_runs_compact():
local_path=flexmock(),
remote_path=flexmock(),
local_borg_version=flexmock(),
repository_path='repo',
repository='repo',
)
)
@ -522,7 +522,7 @@ def test_run_actions_runs_check_when_repository_enabled_for_checks():
local_path=flexmock(),
remote_path=flexmock(),
local_borg_version=flexmock(),
repository_path='repo',
repository='repo',
)
)
@ -545,7 +545,7 @@ def test_run_actions_skips_check_when_repository_not_enabled_for_checks():
local_path=flexmock(),
remote_path=flexmock(),
local_borg_version=flexmock(),
repository_path='repo',
repository='repo',
)
)
@ -567,7 +567,7 @@ def test_run_actions_runs_extract():
local_path=flexmock(),
remote_path=flexmock(),
local_borg_version=flexmock(),
repository_path='repo',
repository='repo',
)
)
@ -589,7 +589,7 @@ def test_run_actions_runs_export_tar():
local_path=flexmock(),
remote_path=flexmock(),
local_borg_version=flexmock(),
repository_path='repo',
repository='repo',
)
)
@ -611,7 +611,7 @@ def test_run_actions_runs_mount():
local_path=flexmock(),
remote_path=flexmock(),
local_borg_version=flexmock(),
repository_path='repo',
repository='repo',
)
)
@ -633,7 +633,7 @@ def test_run_actions_runs_restore():
local_path=flexmock(),
remote_path=flexmock(),
local_borg_version=flexmock(),
repository_path='repo',
repository='repo',
)
)
@ -656,7 +656,7 @@ def test_run_actions_runs_rlist():
local_path=flexmock(),
remote_path=flexmock(),
local_borg_version=flexmock(),
repository_path='repo',
repository='repo',
)
)
assert result == (expected,)
@ -680,7 +680,7 @@ def test_run_actions_runs_list():
local_path=flexmock(),
remote_path=flexmock(),
local_borg_version=flexmock(),
repository_path='repo',
repository='repo',
)
)
assert result == (expected,)
@ -704,7 +704,7 @@ def test_run_actions_runs_rinfo():
local_path=flexmock(),
remote_path=flexmock(),
local_borg_version=flexmock(),
repository_path='repo',
repository='repo',
)
)
assert result == (expected,)
@ -728,7 +728,7 @@ def test_run_actions_runs_info():
local_path=flexmock(),
remote_path=flexmock(),
local_borg_version=flexmock(),
repository_path='repo',
repository='repo',
)
)
assert result == (expected,)
@ -751,7 +751,7 @@ def test_run_actions_runs_break_lock():
local_path=flexmock(),
remote_path=flexmock(),
local_borg_version=flexmock(),
repository_path='repo',
repository='repo',
)
)
@ -773,7 +773,7 @@ def test_run_actions_runs_borg():
local_path=flexmock(),
remote_path=flexmock(),
local_borg_version=flexmock(),
repository_path='repo',
repository='repo',
)
)
@ -800,7 +800,7 @@ def test_run_actions_runs_multiple_actions_in_argument_order():
local_path=flexmock(),
remote_path=flexmock(),
local_borg_version=flexmock(),
repository_path='repo',
repository='repo',
)
)

View File

@ -69,27 +69,27 @@ from borgmatic.config import normalize as module
),
(
{'location': {'repositories': ['foo@bar:/repo']}},
{'location': {'repositories': ['ssh://foo@bar/repo']}},
{'location': {'repositories': [{'path': 'ssh://foo@bar/repo', 'label': ''}]}},
True,
),
(
{'location': {'repositories': ['foo@bar:repo']}},
{'location': {'repositories': ['ssh://foo@bar/./repo']}},
{'location': {'repositories': [{'path': 'ssh://foo@bar/./repo', 'label': ''}]}},
True,
),
(
{'location': {'repositories': ['foo@bar:~/repo']}},
{'location': {'repositories': ['ssh://foo@bar/~/repo']}},
{'location': {'repositories': [{'path': 'ssh://foo@bar/~/repo', 'label': ''}]}},
True,
),
(
{'location': {'repositories': ['ssh://foo@bar:1234/repo']}},
{'location': {'repositories': ['ssh://foo@bar:1234/repo']}},
{'location': {'repositories': [{'path': 'ssh://foo@bar:1234/repo', 'label': ''}]}},
False,
),
(
{'location': {'repositories': ['file:///repo']}},
{'location': {'repositories': ['/repo']}},
{'location': {'repositories': [{'path': '/repo', 'label': ''}]}},
False,
),
),