Fix mount action to work without archive again (#557).
This commit is contained in:
parent
7dee6194a2
commit
f9d7faf884
3 changed files with 36 additions and 16 deletions
|
@ -42,7 +42,11 @@ def mount_archive(
|
|||
+ ('--glob-archives', archive)
|
||||
)
|
||||
if feature.available(feature.Feature.SEPARATE_REPOSITORY_ARCHIVE, local_borg_version)
|
||||
else flags.make_repository_archive_flags(repository, archive, local_borg_version)
|
||||
else (
|
||||
flags.make_repository_archive_flags(repository, archive, local_borg_version)
|
||||
if archive
|
||||
else flags.make_repository_flags(repository, local_borg_version)
|
||||
)
|
||||
)
|
||||
+ (mount_point,)
|
||||
+ (tuple(paths) if paths else ())
|
||||
|
|
|
@ -269,8 +269,8 @@ def make_parsers():
|
|||
transfer_parser = subparsers.add_parser(
|
||||
'transfer',
|
||||
aliases=SUBPARSER_ALIASES['transfer'],
|
||||
help='Transfer archives from one repository to another, optionally upgrading the transferred data',
|
||||
description='Transfer archives from one repository to another, optionally upgrading the transferred data',
|
||||
help='Transfer archives from one repository to another, optionally upgrading the transferred data (Borg 2.0+ only)',
|
||||
description='Transfer archives from one repository to another, optionally upgrading the transferred data (Borg 2.0+ only)',
|
||||
add_help=False,
|
||||
)
|
||||
transfer_group = transfer_parser.add_argument_group('transfer arguments')
|
||||
|
@ -290,7 +290,6 @@ def make_parsers():
|
|||
transfer_group.add_argument(
|
||||
'--upgrader',
|
||||
help='Upgrader type used to convert the transfered data, e.g. "From12To20" to upgrade data from Borg 1.2 to 2.0 format, defaults to no conversion',
|
||||
required=True,
|
||||
)
|
||||
transfer_group.add_argument(
|
||||
'-a',
|
||||
|
|
|
@ -14,16 +14,14 @@ def insert_execute_command_mock(command):
|
|||
).once()
|
||||
|
||||
|
||||
def test_mount_archive_calls_borg_with_required_parameters():
|
||||
def test_mount_archive_calls_borg_with_required_flags():
|
||||
flexmock(module.feature).should_receive('available').and_return(False)
|
||||
flexmock(module.flags).should_receive('make_repository_archive_flags').and_return(
|
||||
('repo::archive',)
|
||||
)
|
||||
insert_execute_command_mock(('borg', 'mount', 'repo::archive', '/mnt'))
|
||||
flexmock(module.flags).should_receive('make_repository_flags').and_return(('repo',))
|
||||
insert_execute_command_mock(('borg', 'mount', 'repo', '/mnt'))
|
||||
|
||||
module.mount_archive(
|
||||
repository='repo',
|
||||
archive='archive',
|
||||
archive=None,
|
||||
mount_point='/mnt',
|
||||
paths=None,
|
||||
foreground=False,
|
||||
|
@ -52,7 +50,26 @@ def test_mount_archive_with_borg_features_calls_borg_with_repository_and_glob_ar
|
|||
)
|
||||
|
||||
|
||||
def test_mount_archive_calls_borg_with_path_parameters():
|
||||
def test_mount_archive_without_archive_calls_borg_with_repository_flags_only():
|
||||
flexmock(module.feature).should_receive('available').and_return(False)
|
||||
flexmock(module.flags).should_receive('make_repository_archive_flags').and_return(
|
||||
('repo::archive',)
|
||||
)
|
||||
insert_execute_command_mock(('borg', 'mount', 'repo::archive', '/mnt'))
|
||||
|
||||
module.mount_archive(
|
||||
repository='repo',
|
||||
archive='archive',
|
||||
mount_point='/mnt',
|
||||
paths=None,
|
||||
foreground=False,
|
||||
options=None,
|
||||
storage_config={},
|
||||
local_borg_version='1.2.3',
|
||||
)
|
||||
|
||||
|
||||
def test_mount_archive_calls_borg_with_path_flags():
|
||||
flexmock(module.feature).should_receive('available').and_return(False)
|
||||
flexmock(module.flags).should_receive('make_repository_archive_flags').and_return(
|
||||
('repo::archive',)
|
||||
|
@ -71,7 +88,7 @@ def test_mount_archive_calls_borg_with_path_parameters():
|
|||
)
|
||||
|
||||
|
||||
def test_mount_archive_calls_borg_with_remote_path_parameters():
|
||||
def test_mount_archive_calls_borg_with_remote_path_flags():
|
||||
flexmock(module.feature).should_receive('available').and_return(False)
|
||||
flexmock(module.flags).should_receive('make_repository_archive_flags').and_return(
|
||||
('repo::archive',)
|
||||
|
@ -93,7 +110,7 @@ def test_mount_archive_calls_borg_with_remote_path_parameters():
|
|||
)
|
||||
|
||||
|
||||
def test_mount_archive_calls_borg_with_umask_parameters():
|
||||
def test_mount_archive_calls_borg_with_umask_flags():
|
||||
flexmock(module.feature).should_receive('available').and_return(False)
|
||||
flexmock(module.flags).should_receive('make_repository_archive_flags').and_return(
|
||||
('repo::archive',)
|
||||
|
@ -112,7 +129,7 @@ def test_mount_archive_calls_borg_with_umask_parameters():
|
|||
)
|
||||
|
||||
|
||||
def test_mount_archive_calls_borg_with_lock_wait_parameters():
|
||||
def test_mount_archive_calls_borg_with_lock_wait_flags():
|
||||
flexmock(module.feature).should_receive('available').and_return(False)
|
||||
flexmock(module.flags).should_receive('make_repository_archive_flags').and_return(
|
||||
('repo::archive',)
|
||||
|
@ -151,7 +168,7 @@ def test_mount_archive_with_log_info_calls_borg_with_info_parameter():
|
|||
)
|
||||
|
||||
|
||||
def test_mount_archive_with_log_debug_calls_borg_with_debug_parameters():
|
||||
def test_mount_archive_with_log_debug_calls_borg_with_debug_flags():
|
||||
flexmock(module.feature).should_receive('available').and_return(False)
|
||||
flexmock(module.flags).should_receive('make_repository_archive_flags').and_return(
|
||||
('repo::archive',)
|
||||
|
@ -196,7 +213,7 @@ def test_mount_archive_calls_borg_with_foreground_parameter():
|
|||
)
|
||||
|
||||
|
||||
def test_mount_archive_calls_borg_with_options_parameters():
|
||||
def test_mount_archive_calls_borg_with_options_flags():
|
||||
flexmock(module.feature).should_receive('available').and_return(False)
|
||||
flexmock(module.flags).should_receive('make_repository_archive_flags').and_return(
|
||||
('repo::archive',)
|
||||
|
|
Loading…
Reference in a new issue