Use make_flags_from_arguments on mount; Pending test fixes

Signed-off-by: Chirag Aggarwal <thechiragaggarwal@gmail.com>
This commit is contained in:
Chirag Aggarwal 2023-03-27 23:24:17 +05:30
parent ff1f4dc09c
commit 4fa4fccab7
1 changed files with 10 additions and 15 deletions

View File

@ -9,10 +9,6 @@ logger = logging.getLogger(__name__)
def mount_archive( def mount_archive(
repository, repository,
archive, archive,
mount_point,
paths,
foreground,
options,
mount_arguments, mount_arguments,
storage_config, storage_config,
local_borg_version, local_borg_version,
@ -35,14 +31,13 @@ def mount_archive(
+ (('--lock-wait', str(lock_wait)) if lock_wait else ()) + (('--lock-wait', str(lock_wait)) if lock_wait else ())
+ (('--info',) if logger.getEffectiveLevel() == logging.INFO else ()) + (('--info',) if logger.getEffectiveLevel() == logging.INFO else ())
+ (('--debug', '--show-rc') if logger.isEnabledFor(logging.DEBUG) else ()) + (('--debug', '--show-rc') if logger.isEnabledFor(logging.DEBUG) else ())
+ (('--foreground',) if foreground else ())
+ (flags.make_flags('first', mount_arguments.first) if mount_arguments.first else ()) + flags.make_flags_from_arguments(
+ (flags.make_flags('last', mount_arguments.last) if mount_arguments.last else ()) mount_arguments,
+ (flags.make_flags('newest', mount_arguments.newest) if mount_arguments.newest else ()) excludes=('repository', 'archive', 'mount_point', 'path', 'options'),
+ (flags.make_flags('oldest', mount_arguments.oldest) if mount_arguments.oldest else ()) )
+ (flags.make_flags('older', mount_arguments.older) if mount_arguments.older else ())
+ (flags.make_flags('newer', mount_arguments.newer) if mount_arguments.newer else ()) + (('-o', mount_arguments.options) if mount_arguments.options else ())
+ (('-o', options) if options else ())
+ ( + (
( (
flags.make_repository_flags(repository, local_borg_version) flags.make_repository_flags(repository, local_borg_version)
@ -59,14 +54,14 @@ def mount_archive(
else flags.make_repository_flags(repository, local_borg_version) else flags.make_repository_flags(repository, local_borg_version)
) )
) )
+ (mount_point,) + (mount_arguments.mount_point,)
+ (tuple(paths) if paths else ()) + (tuple(mount_arguments.paths) if mount_arguments.paths else ())
) )
borg_environment = environment.make_environment(storage_config) borg_environment = environment.make_environment(storage_config)
# Don't capture the output when foreground mode is used so that ctrl-C can work properly. # Don't capture the output when foreground mode is used so that ctrl-C can work properly.
if foreground: if mount_arguments.foreground:
execute_command( execute_command(
full_command, full_command,
output_file=DO_NOT_CAPTURE, output_file=DO_NOT_CAPTURE,