How to use the borgmatic.borg.info.display_archives_info function in borgmatic

To help you get started, we’ve selected a few borgmatic examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github witten / borgmatic / tests / unit / borg / test_info.py View on Github external
def test_display_archives_info_calls_borg_with_parameters():
    flexmock(module).should_receive('execute_command').with_args(
        ('borg', 'info', 'repo'), output_log_level=logging.WARNING, error_on_warnings=False
    )

    module.display_archives_info(
        repository='repo', storage_config={}, info_arguments=flexmock(archive=None, json=False)
    )
github witten / borgmatic / tests / unit / borg / test_info.py View on Github external
def test_display_archives_info_with_log_debug_and_json_suppresses_most_borg_output():
    flexmock(module).should_receive('execute_command').with_args(
        ('borg', 'info', '--json', 'repo'), output_log_level=None, error_on_warnings=False
    ).and_return('[]')

    insert_logging_mock(logging.DEBUG)
    json_output = module.display_archives_info(
        repository='repo', storage_config={}, info_arguments=flexmock(archive=None, json=True)
    )

    assert json_output == '[]'
github witten / borgmatic / tests / unit / borg / test_info.py View on Github external
def test_display_archives_info_passes_through_arguments_to_borg(argument_name):
    flexmock(module).should_receive('execute_command').with_args(
        ('borg', 'info', '--' + argument_name.replace('_', '-'), 'value', 'repo'),
        output_log_level=logging.WARNING,
        error_on_warnings=False,
    )

    module.display_archives_info(
        repository='repo',
        storage_config={},
        info_arguments=flexmock(archive=None, json=False, **{argument_name: 'value'}),
    )
github witten / borgmatic / tests / unit / borg / test_info.py View on Github external
def test_display_archives_info_with_archive_calls_borg_with_archive_parameter():
    flexmock(module).should_receive('execute_command').with_args(
        ('borg', 'info', 'repo::archive'), output_log_level=logging.WARNING, error_on_warnings=False
    )

    module.display_archives_info(
        repository='repo', storage_config={}, info_arguments=flexmock(archive='archive', json=False)
    )
github witten / borgmatic / tests / unit / borg / test_info.py View on Github external
def test_display_archives_info_with_lock_wait_calls_borg_with_lock_wait_parameters():
    storage_config = {'lock_wait': 5}
    flexmock(module).should_receive('execute_command').with_args(
        ('borg', 'info', '--lock-wait', '5', 'repo'),
        output_log_level=logging.WARNING,
        error_on_warnings=False,
    )

    module.display_archives_info(
        repository='repo',
        storage_config=storage_config,
        info_arguments=flexmock(archive=None, json=False),
    )
github witten / borgmatic / tests / unit / borg / test_info.py View on Github external
def test_display_archives_info_with_remote_path_calls_borg_with_remote_path_parameters():
    flexmock(module).should_receive('execute_command').with_args(
        ('borg', 'info', '--remote-path', 'borg1', 'repo'),
        output_log_level=logging.WARNING,
        error_on_warnings=False,
    )

    module.display_archives_info(
        repository='repo',
        storage_config={},
        info_arguments=flexmock(archive=None, json=False),
        remote_path='borg1',
    )
github witten / borgmatic / tests / unit / borg / test_info.py View on Github external
def test_display_archives_info_with_log_info_and_json_suppresses_most_borg_output():
    flexmock(module).should_receive('execute_command').with_args(
        ('borg', 'info', '--json', 'repo'), output_log_level=None, error_on_warnings=False
    ).and_return('[]')

    insert_logging_mock(logging.INFO)
    json_output = module.display_archives_info(
        repository='repo', storage_config={}, info_arguments=flexmock(archive=None, json=True)
    )

    assert json_output == '[]'
github witten / borgmatic / borgmatic / commands / borgmatic.py View on Github external
logger.info('{}: Listing archives'.format(repository))
            json_output = borg_list.list_archives(
                repository,
                storage,
                list_arguments=arguments['list'],
                local_path=local_path,
                remote_path=remote_path,
            )
            if json_output:
                yield json.loads(json_output)
    if 'info' in arguments:
        if arguments['info'].repository is None or validate.repositories_match(
            repository, arguments['info'].repository
        ):
            logger.info('{}: Displaying summary info for archives'.format(repository))
            json_output = borg_info.display_archives_info(
                repository,
                storage,
                info_arguments=arguments['info'],
                local_path=local_path,
                remote_path=remote_path,
            )
            if json_output:
                yield json.loads(json_output)