Add extra_rsync_opts option to do_backup
This commit is contained in:
parent
72ad40e53b
commit
a4cb7d360d
@ -22,7 +22,7 @@ syslog = logging.getLogger(__name__)
|
|||||||
|
|
||||||
|
|
||||||
# ========== Functions ==========
|
# ========== Functions ==========
|
||||||
def do_backup(repository, parsed_config, args):
|
def do_backup(repository, parsed_config, args, extra_rsync_opts=None):
|
||||||
"""Run a backup operation.
|
"""Run a backup operation.
|
||||||
|
|
||||||
It is up to the caller to decide on how to instantiate the Repository object.
|
It is up to the caller to decide on how to instantiate the Repository object.
|
||||||
@ -33,6 +33,8 @@ def do_backup(repository, parsed_config, args):
|
|||||||
:type parsed_config: ``configparser.ConfigParser`` object
|
:type parsed_config: ``configparser.ConfigParser`` object
|
||||||
:param args: arguments relevant to the backup operation
|
:param args: arguments relevant to the backup operation
|
||||||
:type args: ``argparse.Namespace`` object
|
:type args: ``argparse.Namespace`` object
|
||||||
|
:param extra_rsync_opts: more options to pass to rsync
|
||||||
|
:type extra_rsync_opts: iterable
|
||||||
"""
|
"""
|
||||||
rsync_opts = config.load_list_from_option(
|
rsync_opts = config.load_list_from_option(
|
||||||
parsed_config,
|
parsed_config,
|
||||||
@ -44,6 +46,9 @@ def do_backup(repository, parsed_config, args):
|
|||||||
if args.extra_rsync_opts is not None:
|
if args.extra_rsync_opts is not None:
|
||||||
rsync_opts.extend(args.extra_rsync_opts)
|
rsync_opts.extend(args.extra_rsync_opts)
|
||||||
|
|
||||||
|
if extra_rsync_opts is not None:
|
||||||
|
rsync_opts.extend(rsync_opts)
|
||||||
|
|
||||||
# We want to iterate through the repository and create the --link-dest
|
# We want to iterate through the repository and create the --link-dest
|
||||||
# options before creating the new snapshot
|
# options before creating the new snapshot
|
||||||
link_dests = tuple(f"--link-dest={s.path}" for s in repository)
|
link_dests = tuple(f"--link-dest={s.path}" for s in repository)
|
||||||
@ -69,3 +74,4 @@ def do_backup(repository, parsed_config, args):
|
|||||||
syslog.critical(f"Failing command: {e.cmd}")
|
syslog.critical(f"Failing command: {e.cmd}")
|
||||||
syslog.critical(e.stderr)
|
syslog.critical(e.stderr)
|
||||||
exit(e.returncode)
|
exit(e.returncode)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user