diff --git a/borgmatic/config/schema.yaml b/borgmatic/config/schema.yaml index 511e3ceb6..e7181fa88 100644 --- a/borgmatic/config/schema.yaml +++ b/borgmatic/config/schema.yaml @@ -27,12 +27,14 @@ map: desc: | Paths to local or remote repositories (required). Tildes are expanded. Multiple repositories are backed up to in - sequence. See ssh_command for SSH options like identity file - or port. + 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: - user@backupserver:sourcehostname.borg + - "user@backupserver:{fqdn}" one_file_system: type: bool desc: | diff --git a/tests/unit/borg/test_create.py b/tests/unit/borg/test_create.py index 89dc2f651..cc568817f 100644 --- a/tests/unit/borg/test_create.py +++ b/tests/unit/borg/test_create.py @@ -1326,6 +1326,34 @@ def test_create_archive_with_archive_name_format_accepts_borg_placeholders(): ) +def test_create_archive_with_repository_accepts_borg_placeholders(): + flexmock(module).should_receive('borgmatic_source_directories').and_return([]) + flexmock(module).should_receive('deduplicate_directories').and_return(('foo', 'bar')) + flexmock(module).should_receive('map_directories_to_devices').and_return({}) + flexmock(module).should_receive('_expand_directories').and_return(()) + flexmock(module).should_receive('_expand_home_directories').and_return(()) + flexmock(module).should_receive('_write_pattern_file').and_return(None) + flexmock(module).should_receive('_make_pattern_flags').and_return(()) + flexmock(module).should_receive('_make_exclude_flags').and_return(()) + flexmock(module).should_receive('execute_command').with_args( + ('borg', 'create', '{fqdn}::Documents_{hostname}-{now}', 'foo', 'bar'), + output_log_level=logging.INFO, + output_file=None, + borg_local_path='borg', + ) + + module.create_archive( + dry_run=False, + repository='{fqdn}', + location_config={ + 'source_directories': ['foo', 'bar'], + 'repositories': ['{fqdn}'], + 'exclude_patterns': None, + }, + storage_config={'archive_name_format': 'Documents_{hostname}-{now}'}, + ) + + def test_create_archive_with_extra_borg_options_calls_borg_with_extra_options(): flexmock(module).should_receive('borgmatic_source_directories').and_return([]) flexmock(module).should_receive('deduplicate_directories').and_return(('foo', 'bar'))