From b7ecc9c6c3f62e0fa45c8413894cb5def51280f8 Mon Sep 17 00:00:00 2001 From: Dan Helfman Date: Sat, 9 May 2026 10:30:48 -0700 Subject: [PATCH] Fix repo-create action (#1267). --- borgmatic/actions/check.py | 22 +++++++++++------ borgmatic/actions/create.py | 10 +++++++- borgmatic/actions/restore.py | 10 +++++++- borgmatic/commands/borgmatic.py | 9 ------- tests/unit/actions/test_check.py | 12 ++++++--- tests/unit/actions/test_create.py | 21 ++++++++++------ tests/unit/actions/test_restore.py | 15 ++++++++---- tests/unit/commands/test_borgmatic.py | 35 ++------------------------- 8 files changed, 66 insertions(+), 68 deletions(-) diff --git a/borgmatic/actions/check.py b/borgmatic/actions/check.py index 8a669da4..96024240 100644 --- a/borgmatic/actions/check.py +++ b/borgmatic/actions/check.py @@ -788,7 +788,15 @@ def run_check( ''' logger.info('Running consistency checks') - upgrade_check_times(config, repository['id']) + repository_id = borgmatic.borg.repo_info.get_repository_id( + repository['path'], + config, + local_borg_version, + global_arguments, + local_path=local_path, + remote_path=remote_path, + ) + upgrade_check_times(config, repository_id) configured_checks = parse_checks(config, check_arguments.only_checks) archive_filter_flags = borgmatic.borg.check.make_archive_filter_flags( local_borg_version, @@ -799,7 +807,7 @@ def run_check( archives_check_id = make_archives_check_id(archive_filter_flags) checks = filter_checks_on_frequency( config, - repository['id'], + repository_id, configured_checks, check_arguments.force, archives_check_id, @@ -819,9 +827,7 @@ def run_check( remote_path=remote_path, ) for check in borg_specific_checks: - write_check_time( - make_check_time_path(config, repository['id'], check, archives_check_id) - ) + write_check_time(make_check_time_path(config, repository_id, check, archives_check_id)) if 'extract' in checks: logger.info('Running extract check') @@ -834,12 +840,12 @@ def run_check( local_path, remote_path, ) - write_check_time(make_check_time_path(config, repository['id'], 'extract')) + write_check_time(make_check_time_path(config, repository_id, 'extract')) if 'spot' in checks: logger.info('Running spot check') with borgmatic.config.paths.Runtime_directory( - config, repository['id'] + config, repository_id ) as borgmatic_runtime_directory: spot_check( repository, @@ -851,4 +857,4 @@ def run_check( borgmatic_runtime_directory, ) - write_check_time(make_check_time_path(config, repository['id'], 'spot')) + write_check_time(make_check_time_path(config, repository_id, 'spot')) diff --git a/borgmatic/actions/create.py b/borgmatic/actions/create.py index 2c85803e..89b7d53b 100644 --- a/borgmatic/actions/create.py +++ b/borgmatic/actions/create.py @@ -42,9 +42,17 @@ def run_create( logger.info(f'Creating archive{dry_run_label}') working_directory = borgmatic.config.paths.get_working_directory(config) + repository_id = borgmatic.borg.repo_info.get_repository_id( + repository['path'], + config, + local_borg_version, + global_arguments, + local_path=local_path, + remote_path=remote_path, + ) with borgmatic.config.paths.Runtime_directory( - config, repository['id'] + config, repository_id ) as borgmatic_runtime_directory: patterns = pattern.process_patterns( pattern.collect_patterns(config, working_directory), diff --git a/borgmatic/actions/restore.py b/borgmatic/actions/restore.py index 814388c6..8382b3b7 100644 --- a/borgmatic/actions/restore.py +++ b/borgmatic/actions/restore.py @@ -536,9 +536,17 @@ def run_restore( ''' logger.info(f'Restoring data sources from archive {restore_arguments.archive}') working_directory = borgmatic.config.paths.get_working_directory(config) + repository_id = borgmatic.borg.repo_info.get_repository_id( + repository['path'], + config, + local_borg_version, + global_arguments, + local_path=local_path, + remote_path=remote_path, + ) with borgmatic.config.paths.Runtime_directory( - config, repository['id'] + config, repository_id ) as borgmatic_runtime_directory: patterns = borgmatic.actions.pattern.process_patterns( borgmatic.actions.pattern.collect_patterns(config, working_directory), diff --git a/borgmatic/commands/borgmatic.py b/borgmatic/commands/borgmatic.py index ab5812b8..83c77829 100644 --- a/borgmatic/commands/borgmatic.py +++ b/borgmatic/commands/borgmatic.py @@ -381,15 +381,6 @@ def run_actions( # noqa: PLR0912, PLR0915 logger.debug('Skipping actions because the requested --repository does not match') return - repository['id'] = borgmatic.borg.repo_info.get_repository_id( - repository['path'], - config, - local_borg_version, - global_arguments, - local_path=local_path, - remote_path=remote_path, - ) - with borgmatic.hooks.command.Before_after_hooks( command_hooks=config.get('commands'), before_after='repository', diff --git a/tests/unit/actions/test_check.py b/tests/unit/actions/test_check.py index 4b95516c..911eaef6 100644 --- a/tests/unit/actions/test_check.py +++ b/tests/unit/actions/test_check.py @@ -1838,6 +1838,7 @@ def test_spot_check_without_any_source_paths_errors(): def test_run_check_checks_archives_for_configured_repository(): flexmock(module.logger).answer = lambda message: None + flexmock(module.borgmatic.borg.repo_info).should_receive('get_repository_id').and_return('id') flexmock(module).should_receive('upgrade_check_times') flexmock(module).should_receive('parse_checks') flexmock(module.borgmatic.borg.check).should_receive('make_archive_filter_flags').and_return(()) @@ -1860,7 +1861,7 @@ def test_run_check_checks_archives_for_configured_repository(): module.run_check( config_filename='test.yaml', - repository={'path': 'repo', 'id': 'repo'}, + repository={'path': 'repo'}, config={'repositories': ['repo']}, local_borg_version=None, check_arguments=check_arguments, @@ -1872,6 +1873,7 @@ def test_run_check_checks_archives_for_configured_repository(): def test_run_check_runs_configured_extract_check(): flexmock(module.logger).answer = lambda message: None + flexmock(module.borgmatic.borg.repo_info).should_receive('get_repository_id').and_return('id') flexmock(module).should_receive('upgrade_check_times') flexmock(module).should_receive('parse_checks') flexmock(module.borgmatic.borg.check).should_receive('make_archive_filter_flags').and_return(()) @@ -1892,7 +1894,7 @@ def test_run_check_runs_configured_extract_check(): module.run_check( config_filename='test.yaml', - repository={'path': 'repo', 'id': 'repo'}, + repository={'path': 'repo'}, config={'repositories': ['repo']}, local_borg_version=None, check_arguments=check_arguments, @@ -1904,6 +1906,7 @@ def test_run_check_runs_configured_extract_check(): def test_run_check_runs_configured_spot_check(): flexmock(module.logger).answer = lambda message: None + flexmock(module.borgmatic.borg.repo_info).should_receive('get_repository_id').and_return('id') flexmock(module).should_receive('upgrade_check_times') flexmock(module).should_receive('parse_checks') flexmock(module.borgmatic.borg.check).should_receive('make_archive_filter_flags').and_return(()) @@ -1927,7 +1930,7 @@ def test_run_check_runs_configured_spot_check(): module.run_check( config_filename='test.yaml', - repository={'path': 'repo', 'id': 'repo'}, + repository={'path': 'repo'}, config={'repositories': ['repo']}, local_borg_version=None, check_arguments=check_arguments, @@ -1939,6 +1942,7 @@ def test_run_check_runs_configured_spot_check(): def test_run_check_without_checks_runs_nothing_except_hooks(): flexmock(module.logger).answer = lambda message: None + flexmock(module.borgmatic.borg.repo_info).should_receive('get_repository_id').and_return('id') flexmock(module).should_receive('upgrade_check_times') flexmock(module).should_receive('parse_checks') flexmock(module.borgmatic.borg.check).should_receive('make_archive_filter_flags').and_return(()) @@ -1959,7 +1963,7 @@ def test_run_check_without_checks_runs_nothing_except_hooks(): module.run_check( config_filename='test.yaml', - repository={'path': 'repo', 'id': 'repo'}, + repository={'path': 'repo'}, config={'repositories': ['repo']}, local_borg_version=None, check_arguments=check_arguments, diff --git a/tests/unit/actions/test_create.py b/tests/unit/actions/test_create.py index 983f179f..18c352b7 100644 --- a/tests/unit/actions/test_create.py +++ b/tests/unit/actions/test_create.py @@ -11,6 +11,7 @@ from borgmatic.actions import create as module def test_run_create_executes_and_calls_hooks_for_configured_repository(): flexmock(module.logger).answer = lambda message: None + flexmock(module.borgmatic.borg.repo_info).should_receive('get_repository_id').and_return('id') flexmock(module.borgmatic.config.paths).should_receive('Runtime_directory').and_return( flexmock(), ) @@ -34,7 +35,7 @@ def test_run_create_executes_and_calls_hooks_for_configured_repository(): list( module.run_create( config_filename='test.yaml', - repository={'path': 'repo', 'id': 'repo'}, + repository={'path': 'repo'}, config={}, config_paths=['/tmp/test.yaml'], local_borg_version=None, @@ -49,6 +50,7 @@ def test_run_create_executes_and_calls_hooks_for_configured_repository(): def test_run_create_with_both_list_and_json_errors(): flexmock(module.logger).answer = lambda message: None + flexmock(module.borgmatic.borg.repo_info).should_receive('get_repository_id').never() flexmock(module.borgmatic.config.paths).should_receive('Runtime_directory').never() flexmock(module.borgmatic.borg.create).should_receive('create_archive').never() create_arguments = flexmock( @@ -65,7 +67,7 @@ def test_run_create_with_both_list_and_json_errors(): list( module.run_create( config_filename='test.yaml', - repository={'path': 'repo', 'id': 'repo'}, + repository={'path': 'repo'}, config={'list_details': True}, config_paths=['/tmp/test.yaml'], local_borg_version=None, @@ -80,6 +82,7 @@ def test_run_create_with_both_list_and_json_errors(): def test_run_create_with_both_list_and_progress_errors(): flexmock(module.logger).answer = lambda message: None + flexmock(module.borgmatic.borg.repo_info).should_receive('get_repository_id').never() flexmock(module.borgmatic.config.paths).should_receive('Runtime_directory').never() flexmock(module.borgmatic.borg.create).should_receive('create_archive').never() create_arguments = flexmock( @@ -96,7 +99,7 @@ def test_run_create_with_both_list_and_progress_errors(): list( module.run_create( config_filename='test.yaml', - repository={'path': 'repo', 'id': 'repo'}, + repository={'path': 'repo'}, config={'list_details': True, 'progress': True}, config_paths=['/tmp/test.yaml'], local_borg_version=None, @@ -111,6 +114,7 @@ def test_run_create_with_both_list_and_progress_errors(): def test_run_create_produces_json(): flexmock(module.logger).answer = lambda message: None + flexmock(module.borgmatic.borg.repo_info).should_receive('get_repository_id').and_return('id') flexmock(module.borgmatic.config.paths).should_receive('Runtime_directory').and_return( flexmock(), ) @@ -138,7 +142,7 @@ def test_run_create_produces_json(): assert list( module.run_create( config_filename='test.yaml', - repository={'path': 'repo', 'id': 'repo'}, + repository={'path': 'repo'}, config={}, config_paths=['/tmp/test.yaml'], local_borg_version=None, @@ -156,6 +160,7 @@ def test_run_create_with_active_dumps_roundtrips_via_checkpoint_archive(): mock_dump_process.should_receive('poll').and_return(None).and_return(0) flexmock(module.logger).answer = lambda message: None + flexmock(module.borgmatic.borg.repo_info).should_receive('get_repository_id').and_return('id') flexmock(module.borgmatic.config.paths).should_receive('Runtime_directory').and_return( flexmock(), ) @@ -194,7 +199,7 @@ def test_run_create_with_active_dumps_roundtrips_via_checkpoint_archive(): list( module.run_create( config_filename='test.yaml', - repository={'path': 'repo', 'id': 'repo'}, + repository={'path': 'repo'}, config={}, config_paths=['/tmp/test.yaml'], local_borg_version=None, @@ -234,6 +239,7 @@ def test_run_create_with_active_dumps_json_updates_archive_info(): } flexmock(module.logger).answer = lambda message: None + flexmock(module.borgmatic.borg.repo_info).should_receive('get_repository_id').and_return('id') flexmock(module.borgmatic.config.paths).should_receive('Runtime_directory').and_return( flexmock(), ) @@ -277,7 +283,7 @@ def test_run_create_with_active_dumps_json_updates_archive_info(): assert list( module.run_create( config_filename='test.yaml', - repository={'path': 'repo', 'id': 'repo'}, + repository={'path': 'repo'}, config={}, config_paths=['/tmp/test.yaml'], local_borg_version=None, @@ -316,6 +322,7 @@ def mock_dump_cleanup(config, borgmatic_runtime_directory, patterns, dry_run): def test_run_create_with_active_dumps_removes_data_source_dumps_with_original_patterns(): flexmock(module.logger).answer = lambda message: None + flexmock(module.borgmatic.borg.repo_info).should_receive('get_repository_id').and_return('id') flexmock(module.borgmatic.config.paths).should_receive('Runtime_directory').and_return( flexmock(), ) @@ -360,7 +367,7 @@ def test_run_create_with_active_dumps_removes_data_source_dumps_with_original_pa list( module.run_create( config_filename='test.yaml', - repository={'path': 'repo', 'id': 'repo'}, + repository={'path': 'repo'}, config={}, config_paths=['/tmp/test.yaml'], local_borg_version=None, diff --git a/tests/unit/actions/test_restore.py b/tests/unit/actions/test_restore.py index 40b62158..31b66d34 100644 --- a/tests/unit/actions/test_restore.py +++ b/tests/unit/actions/test_restore.py @@ -1175,6 +1175,7 @@ def test_run_restore_restores_each_data_source(): } borgmatic_runtime_directory = flexmock() + flexmock(module.borgmatic.borg.repo_info).should_receive('get_repository_id').and_return('id') flexmock(module.borgmatic.config.paths).should_receive('Runtime_directory').and_return( borgmatic_runtime_directory, ) @@ -1222,7 +1223,7 @@ def test_run_restore_restores_each_data_source(): flexmock(module).should_receive('ensure_requested_dumps_restored') module.run_restore( - repository={'path': 'repo', 'id': 'repo'}, + repository={'path': 'repo'}, config=flexmock(), local_borg_version=flexmock(), restore_arguments=flexmock( @@ -1249,6 +1250,7 @@ def test_run_restore_restores_data_source_by_falling_back_to_all_name(): } borgmatic_runtime_directory = flexmock() + flexmock(module.borgmatic.borg.repo_info).should_receive('get_repository_id').and_return('id') flexmock(module.borgmatic.config.paths).should_receive('Runtime_directory').and_return( borgmatic_runtime_directory, ) @@ -1283,7 +1285,7 @@ def test_run_restore_restores_data_source_by_falling_back_to_all_name(): flexmock(module).should_receive('ensure_requested_dumps_restored') module.run_restore( - repository={'path': 'repo', 'id': 'repo'}, + repository={'path': 'repo'}, config=flexmock(), local_borg_version=flexmock(), restore_arguments=flexmock( @@ -1311,6 +1313,7 @@ def test_run_restore_restores_data_source_configured_with_all_name(): } borgmatic_runtime_directory = flexmock() + flexmock(module.borgmatic.borg.repo_info).should_receive('get_repository_id').and_return('id') flexmock(module.borgmatic.config.paths).should_receive('Runtime_directory').and_return( borgmatic_runtime_directory, ) @@ -1367,7 +1370,7 @@ def test_run_restore_restores_data_source_configured_with_all_name(): flexmock(module).should_receive('ensure_requested_dumps_restored') module.run_restore( - repository={'path': 'repo', 'id': 'repo'}, + repository={'path': 'repo'}, config=flexmock(), local_borg_version=flexmock(), restore_arguments=flexmock( @@ -1395,6 +1398,7 @@ def test_run_restore_skips_missing_data_source(): } borgmatic_runtime_directory = flexmock() + flexmock(module.borgmatic.borg.repo_info).should_receive('get_repository_id').and_return('id') flexmock(module.borgmatic.config.paths).should_receive('Runtime_directory').and_return( borgmatic_runtime_directory, ) @@ -1451,7 +1455,7 @@ def test_run_restore_skips_missing_data_source(): flexmock(module).should_receive('ensure_requested_dumps_restored') module.run_restore( - repository={'path': 'repo', 'id': 'repo'}, + repository={'path': 'repo'}, config=flexmock(), local_borg_version=flexmock(), restore_arguments=flexmock( @@ -1479,6 +1483,7 @@ def test_run_restore_restores_data_sources_from_different_hooks(): } borgmatic_runtime_directory = flexmock() + flexmock(module.borgmatic.borg.repo_info).should_receive('get_repository_id').and_return('id') flexmock(module.borgmatic.config.paths).should_receive('Runtime_directory').and_return( borgmatic_runtime_directory, ) @@ -1531,7 +1536,7 @@ def test_run_restore_restores_data_sources_from_different_hooks(): flexmock(module).should_receive('ensure_requested_dumps_restored') module.run_restore( - repository={'path': 'repo', 'id': 'repo'}, + repository={'path': 'repo'}, config=flexmock(), local_borg_version=flexmock(), restore_arguments=flexmock( diff --git a/tests/unit/commands/test_borgmatic.py b/tests/unit/commands/test_borgmatic.py index bda2f4ae..73ae1a09 100644 --- a/tests/unit/commands/test_borgmatic.py +++ b/tests/unit/commands/test_borgmatic.py @@ -940,7 +940,6 @@ def test_run_actions_runs_repo_create(): flexmock(module).should_receive('add_custom_log_levels') flexmock(module).should_receive('get_skip_actions').and_return([]) flexmock(module.borgmatic.config.validate).should_receive('repositories_match').never() - flexmock(module.borgmatic.borg.repo_info).should_receive('get_repository_id').and_return('repo') flexmock(module.borgmatic.config.paths).should_receive('get_working_directory').and_return( flexmock(), ) @@ -968,7 +967,6 @@ def test_run_actions_with_matching_repository_flag_runs_repo_create(): flexmock(module).should_receive('add_custom_log_levels') flexmock(module).should_receive('get_skip_actions').and_return([]) flexmock(module.borgmatic.config.validate).should_receive('repositories_match').and_return(True) - flexmock(module.borgmatic.borg.repo_info).should_receive('get_repository_id').and_return('repo') flexmock(module.borgmatic.config.paths).should_receive('get_working_directory').and_return( flexmock(), ) @@ -998,7 +996,6 @@ def test_run_actions_with_non_matching_repository_flag_bails(): flexmock(module.borgmatic.config.validate).should_receive('repositories_match').and_return( False ) - flexmock(module.borgmatic.borg.repo_info).should_receive('get_repository_id').and_return('repo') flexmock(module.borgmatic.config.paths).should_receive('get_working_directory').never() flexmock(module.command).should_receive('Before_after_hooks').never() flexmock(borgmatic.actions.repo_create).should_receive('run_repo_create').never() @@ -1024,7 +1021,6 @@ def test_run_actions_adds_label_file_to_hook_context(): flexmock(module).should_receive('add_custom_log_levels') flexmock(module).should_receive('get_skip_actions').and_return([]) flexmock(module.borgmatic.config.validate).should_receive('repositories_match').never() - flexmock(module.borgmatic.borg.repo_info).should_receive('get_repository_id').and_return('repo') flexmock(module.borgmatic.config.paths).should_receive('get_working_directory').and_return( flexmock(), ) @@ -1032,7 +1028,7 @@ def test_run_actions_adds_label_file_to_hook_context(): expected = flexmock() flexmock(borgmatic.actions.create).should_receive('run_create').with_args( config_filename=object, - repository={'path': 'repo', 'id': 'repo', 'label': 'my repo'}, + repository={'path': 'repo', 'label': 'my repo'}, config={'repositories': []}, config_paths=[], local_borg_version=object, @@ -1062,7 +1058,6 @@ def test_run_actions_adds_log_file_to_hook_context(): flexmock(module).should_receive('add_custom_log_levels') flexmock(module).should_receive('get_skip_actions').and_return([]) flexmock(module.borgmatic.config.validate).should_receive('repositories_match').never() - flexmock(module.borgmatic.borg.repo_info).should_receive('get_repository_id').and_return('repo') flexmock(module.borgmatic.config.paths).should_receive('get_working_directory').and_return( flexmock(), ) @@ -1070,7 +1065,7 @@ def test_run_actions_adds_log_file_to_hook_context(): expected = flexmock() flexmock(borgmatic.actions.create).should_receive('run_create').with_args( config_filename=object, - repository={'path': 'repo', 'id': 'repo'}, + repository={'path': 'repo'}, config={'repositories': [], 'log_file': 'foo'}, config_paths=[], local_borg_version=object, @@ -1100,7 +1095,6 @@ def test_run_actions_runs_transfer(): flexmock(module).should_receive('add_custom_log_levels') flexmock(module).should_receive('get_skip_actions').and_return([]) flexmock(module.borgmatic.config.validate).should_receive('repositories_match').never() - flexmock(module.borgmatic.borg.repo_info).should_receive('get_repository_id').and_return('repo') flexmock(module.borgmatic.config.paths).should_receive('get_working_directory').and_return( flexmock(), ) @@ -1125,7 +1119,6 @@ def test_run_actions_runs_create(): flexmock(module).should_receive('add_custom_log_levels') flexmock(module).should_receive('get_skip_actions').and_return([]) flexmock(module.borgmatic.config.validate).should_receive('repositories_match').never() - flexmock(module.borgmatic.borg.repo_info).should_receive('get_repository_id').and_return('repo') flexmock(module.borgmatic.config.paths).should_receive('get_working_directory').and_return( flexmock(), ) @@ -1152,7 +1145,6 @@ def test_run_actions_with_skip_actions_does_not_run_action_or_action_command_hoo flexmock(module).should_receive('add_custom_log_levels') flexmock(module).should_receive('get_skip_actions').and_return(['create']) flexmock(module.borgmatic.config.validate).should_receive('repositories_match').never() - flexmock(module.borgmatic.borg.repo_info).should_receive('get_repository_id').and_return('repo') flexmock(module.borgmatic.config.paths).should_receive('get_working_directory').and_return( flexmock(), ) @@ -1190,7 +1182,6 @@ def test_run_actions_runs_recreate(): flexmock(module).should_receive('add_custom_log_levels') flexmock(module).should_receive('get_skip_actions').and_return([]) flexmock(module.borgmatic.config.validate).should_receive('repositories_match').never() - flexmock(module.borgmatic.borg.repo_info).should_receive('get_repository_id').and_return('repo') flexmock(module.borgmatic.config.paths).should_receive('get_working_directory').and_return( flexmock(), ) @@ -1216,7 +1207,6 @@ def test_run_actions_runs_prune(): flexmock(module).should_receive('add_custom_log_levels') flexmock(module).should_receive('get_skip_actions').and_return([]) flexmock(module.borgmatic.config.validate).should_receive('repositories_match').never() - flexmock(module.borgmatic.borg.repo_info).should_receive('get_repository_id').and_return('repo') flexmock(module.borgmatic.config.paths).should_receive('get_working_directory').and_return( flexmock(), ) @@ -1241,7 +1231,6 @@ def test_run_actions_runs_compact(): flexmock(module).should_receive('add_custom_log_levels') flexmock(module).should_receive('get_skip_actions').and_return([]) flexmock(module.borgmatic.config.validate).should_receive('repositories_match').never() - flexmock(module.borgmatic.borg.repo_info).should_receive('get_repository_id').and_return('repo') flexmock(module.borgmatic.config.paths).should_receive('get_working_directory').and_return( flexmock(), ) @@ -1266,7 +1255,6 @@ def test_run_actions_runs_check_when_repository_enabled_for_checks(): flexmock(module).should_receive('add_custom_log_levels') flexmock(module).should_receive('get_skip_actions').and_return([]) flexmock(module.borgmatic.config.validate).should_receive('repositories_match').never() - flexmock(module.borgmatic.borg.repo_info).should_receive('get_repository_id').and_return('repo') flexmock(module.borgmatic.config.paths).should_receive('get_working_directory').and_return( flexmock(), ) @@ -1292,7 +1280,6 @@ def test_run_actions_skips_check_when_repository_not_enabled_for_checks(): flexmock(module).should_receive('add_custom_log_levels') flexmock(module).should_receive('get_skip_actions').and_return([]) flexmock(module.borgmatic.config.validate).should_receive('repositories_match').never() - flexmock(module.borgmatic.borg.repo_info).should_receive('get_repository_id').and_return('repo') flexmock(module.borgmatic.config.paths).should_receive('get_working_directory').and_return( flexmock(), ) @@ -1318,7 +1305,6 @@ def test_run_actions_runs_extract(): flexmock(module).should_receive('add_custom_log_levels') flexmock(module).should_receive('get_skip_actions').and_return([]) flexmock(module.borgmatic.config.validate).should_receive('repositories_match').never() - flexmock(module.borgmatic.borg.repo_info).should_receive('get_repository_id').and_return('repo') flexmock(module.borgmatic.config.paths).should_receive('get_working_directory').and_return( flexmock(), ) @@ -1343,7 +1329,6 @@ def test_run_actions_runs_export_tar(): flexmock(module).should_receive('add_custom_log_levels') flexmock(module).should_receive('get_skip_actions').and_return([]) flexmock(module.borgmatic.config.validate).should_receive('repositories_match').never() - flexmock(module.borgmatic.borg.repo_info).should_receive('get_repository_id').and_return('repo') flexmock(module.borgmatic.config.paths).should_receive('get_working_directory').and_return( flexmock(), ) @@ -1368,7 +1353,6 @@ def test_run_actions_runs_mount(): flexmock(module).should_receive('add_custom_log_levels') flexmock(module).should_receive('get_skip_actions').and_return([]) flexmock(module.borgmatic.config.validate).should_receive('repositories_match').never() - flexmock(module.borgmatic.borg.repo_info).should_receive('get_repository_id').and_return('repo') flexmock(module.borgmatic.config.paths).should_receive('get_working_directory').and_return( flexmock(), ) @@ -1393,7 +1377,6 @@ def test_run_actions_runs_restore(): flexmock(module).should_receive('add_custom_log_levels') flexmock(module).should_receive('get_skip_actions').and_return([]) flexmock(module.borgmatic.config.validate).should_receive('repositories_match').never() - flexmock(module.borgmatic.borg.repo_info).should_receive('get_repository_id').and_return('repo') flexmock(module.borgmatic.config.paths).should_receive('get_working_directory').and_return( flexmock(), ) @@ -1418,7 +1401,6 @@ def test_run_actions_runs_repo_list(): flexmock(module).should_receive('add_custom_log_levels') flexmock(module).should_receive('get_skip_actions').and_return([]) flexmock(module.borgmatic.config.validate).should_receive('repositories_match').never() - flexmock(module.borgmatic.borg.repo_info).should_receive('get_repository_id').and_return('repo') flexmock(module.borgmatic.config.paths).should_receive('get_working_directory').and_return( flexmock(), ) @@ -1445,7 +1427,6 @@ def test_run_actions_runs_list(): flexmock(module).should_receive('add_custom_log_levels') flexmock(module).should_receive('get_skip_actions').and_return([]) flexmock(module.borgmatic.config.validate).should_receive('repositories_match').never() - flexmock(module.borgmatic.borg.repo_info).should_receive('get_repository_id').and_return('repo') flexmock(module.borgmatic.config.paths).should_receive('get_working_directory').and_return( flexmock(), ) @@ -1472,7 +1453,6 @@ def test_run_actions_runs_repo_info(): flexmock(module).should_receive('add_custom_log_levels') flexmock(module).should_receive('get_skip_actions').and_return([]) flexmock(module.borgmatic.config.validate).should_receive('repositories_match').never() - flexmock(module.borgmatic.borg.repo_info).should_receive('get_repository_id').and_return('repo') flexmock(module.borgmatic.config.paths).should_receive('get_working_directory').and_return( flexmock(), ) @@ -1499,7 +1479,6 @@ def test_run_actions_runs_info(): flexmock(module).should_receive('add_custom_log_levels') flexmock(module).should_receive('get_skip_actions').and_return([]) flexmock(module.borgmatic.config.validate).should_receive('repositories_match').never() - flexmock(module.borgmatic.borg.repo_info).should_receive('get_repository_id').and_return('repo') flexmock(module.borgmatic.config.paths).should_receive('get_working_directory').and_return( flexmock(), ) @@ -1526,7 +1505,6 @@ def test_run_actions_runs_break_lock(): flexmock(module).should_receive('add_custom_log_levels') flexmock(module).should_receive('get_skip_actions').and_return([]) flexmock(module.borgmatic.config.validate).should_receive('repositories_match').never() - flexmock(module.borgmatic.borg.repo_info).should_receive('get_repository_id').and_return('repo') flexmock(module.borgmatic.config.paths).should_receive('get_working_directory').and_return( flexmock(), ) @@ -1551,7 +1529,6 @@ def test_run_actions_runs_export_key(): flexmock(module).should_receive('add_custom_log_levels') flexmock(module).should_receive('get_skip_actions').and_return([]) flexmock(module.borgmatic.config.validate).should_receive('repositories_match').never() - flexmock(module.borgmatic.borg.repo_info).should_receive('get_repository_id').and_return('repo') flexmock(module.borgmatic.config.paths).should_receive('get_working_directory').and_return( flexmock(), ) @@ -1576,7 +1553,6 @@ def test_run_actions_runs_import_key(): flexmock(module).should_receive('add_custom_log_levels') flexmock(module).should_receive('get_skip_actions').and_return([]) flexmock(module.borgmatic.config.validate).should_receive('repositories_match').never() - flexmock(module.borgmatic.borg.repo_info).should_receive('get_repository_id').and_return('repo') flexmock(module.borgmatic.config.paths).should_receive('get_working_directory').and_return( flexmock(), ) @@ -1601,7 +1577,6 @@ def test_run_actions_runs_change_passphrase(): flexmock(module).should_receive('add_custom_log_levels') flexmock(module).should_receive('get_skip_actions').and_return([]) flexmock(module.borgmatic.config.validate).should_receive('repositories_match').never() - flexmock(module.borgmatic.borg.repo_info).should_receive('get_repository_id').and_return('repo') flexmock(module.borgmatic.config.paths).should_receive('get_working_directory').and_return( flexmock(), ) @@ -1629,7 +1604,6 @@ def test_run_actions_runs_delete(): flexmock(module).should_receive('add_custom_log_levels') flexmock(module).should_receive('get_skip_actions').and_return([]) flexmock(module.borgmatic.config.validate).should_receive('repositories_match').never() - flexmock(module.borgmatic.borg.repo_info).should_receive('get_repository_id').and_return('repo') flexmock(module.borgmatic.config.paths).should_receive('get_working_directory').and_return( flexmock(), ) @@ -1654,7 +1628,6 @@ def test_run_actions_runs_repo_delete(): flexmock(module).should_receive('add_custom_log_levels') flexmock(module).should_receive('get_skip_actions').and_return([]) flexmock(module.borgmatic.config.validate).should_receive('repositories_match').never() - flexmock(module.borgmatic.borg.repo_info).should_receive('get_repository_id').and_return('repo') flexmock(module.borgmatic.config.paths).should_receive('get_working_directory').and_return( flexmock(), ) @@ -1682,7 +1655,6 @@ def test_run_actions_runs_borg(): flexmock(module).should_receive('add_custom_log_levels') flexmock(module).should_receive('get_skip_actions').and_return([]) flexmock(module.borgmatic.config.validate).should_receive('repositories_match').never() - flexmock(module.borgmatic.borg.repo_info).should_receive('get_repository_id').and_return('repo') flexmock(module.borgmatic.config.paths).should_receive('get_working_directory').and_return( flexmock(), ) @@ -1707,7 +1679,6 @@ def test_run_actions_runs_multiple_actions_in_argument_order(): flexmock(module).should_receive('add_custom_log_levels') flexmock(module).should_receive('get_skip_actions').and_return([]) flexmock(module.borgmatic.config.validate).should_receive('repositories_match').never() - flexmock(module.borgmatic.borg.repo_info).should_receive('get_repository_id').and_return('repo') flexmock(module.borgmatic.config.paths).should_receive('get_working_directory').and_return( flexmock(), ) @@ -1737,7 +1708,6 @@ def test_run_actions_runs_action_hooks_for_one_action_at_a_time(): flexmock(module).should_receive('add_custom_log_levels') flexmock(module).should_receive('get_skip_actions').and_return([]) flexmock(module.borgmatic.config.validate).should_receive('repositories_match').never() - flexmock(module.borgmatic.borg.repo_info).should_receive('get_repository_id').and_return('repo') flexmock(module.borgmatic.config.paths).should_receive('get_working_directory').and_return( flexmock(), ) @@ -2742,7 +2712,6 @@ def test_run_actions_runs_diff(): flexmock(module).should_receive('add_custom_log_levels') flexmock(module).should_receive('get_skip_actions').and_return([]) flexmock(module.borgmatic.config.validate).should_receive('repositories_match').never() - flexmock(module.borgmatic.borg.repo_info).should_receive('get_repository_id').and_return('repo') flexmock(module.borgmatic.config.paths).should_receive('get_working_directory').and_return( flexmock(), )