Move source and target positional arguments to the end, required for Duplicity 2.1.0

(Modified by JT.)
This commit is contained in:
Jeff Volkenant 2023-08-30 21:48:51 -07:00 committed by Joshua Tauberer
parent c034b0f789
commit 7be687e601
1 changed files with 18 additions and 12 deletions

View File

@ -59,8 +59,9 @@ def backup_status(env):
"--archive-dir", backup_cache_dir, "--archive-dir", backup_cache_dir,
"--gpg-options", "'--cipher-algo=AES256'", "--gpg-options", "'--cipher-algo=AES256'",
"--log-fd", "1", "--log-fd", "1",
get_duplicity_target_url(config), ] + get_duplicity_additional_args(env) + [
] + get_duplicity_additional_args(env), get_duplicity_target_url(config)
],
get_duplicity_env_vars(env), get_duplicity_env_vars(env),
trap=True) trap=True)
if code != 0: if code != 0:
@ -227,8 +228,8 @@ def get_duplicity_additional_args(env):
port = 22 port = 22
return [ return [
f"--ssh-options= -i /root/.ssh/id_rsa_miab -p {port}", f"--ssh-options='-i /root/.ssh/id_rsa_miab -p {port}'",
f"--rsync-options= -e \"/usr/bin/ssh -oStrictHostKeyChecking=no -oBatchMode=yes -p {port} -i /root/.ssh/id_rsa_miab\"", f"--rsync-options='-e \"/usr/bin/ssh -oStrictHostKeyChecking=no -oBatchMode=yes -p {port} -i /root/.ssh/id_rsa_miab\"'",
] ]
elif get_target_type(config) == 's3': elif get_target_type(config) == 's3':
# See note about hostname in get_duplicity_target_url. # See note about hostname in get_duplicity_target_url.
@ -322,10 +323,11 @@ def perform_backup(full_backup):
"--exclude", backup_root, "--exclude", backup_root,
"--volsize", "250", "--volsize", "250",
"--gpg-options", "'--cipher-algo=AES256'", "--gpg-options", "'--cipher-algo=AES256'",
"--allow-source-mismatch"
] + get_duplicity_additional_args(env) + [
env["STORAGE_ROOT"], env["STORAGE_ROOT"],
get_duplicity_target_url(config), get_duplicity_target_url(config),
"--allow-source-mismatch" ],
] + get_duplicity_additional_args(env),
get_duplicity_env_vars(env)) get_duplicity_env_vars(env))
finally: finally:
# Start services again. # Start services again.
@ -343,8 +345,9 @@ def perform_backup(full_backup):
"--verbosity", "error", "--verbosity", "error",
"--archive-dir", backup_cache_dir, "--archive-dir", backup_cache_dir,
"--force", "--force",
] + get_duplicity_additional_args(env) + [
get_duplicity_target_url(config) get_duplicity_target_url(config)
] + get_duplicity_additional_args(env), ],
get_duplicity_env_vars(env)) get_duplicity_env_vars(env))
# From duplicity's manual: # From duplicity's manual:
@ -358,8 +361,9 @@ def perform_backup(full_backup):
"--verbosity", "error", "--verbosity", "error",
"--archive-dir", backup_cache_dir, "--archive-dir", backup_cache_dir,
"--force", "--force",
] + get_duplicity_additional_args(env) + [
get_duplicity_target_url(config) get_duplicity_target_url(config)
] + get_duplicity_additional_args(env), ],
get_duplicity_env_vars(env)) get_duplicity_env_vars(env))
# Change ownership of backups to the user-data user, so that the after-bcakup # Change ownership of backups to the user-data user, so that the after-bcakup
@ -396,9 +400,10 @@ def run_duplicity_verification():
"--compare-data", "--compare-data",
"--archive-dir", backup_cache_dir, "--archive-dir", backup_cache_dir,
"--exclude", backup_root, "--exclude", backup_root,
] + get_duplicity_additional_args(env) + [
get_duplicity_target_url(config), get_duplicity_target_url(config),
env["STORAGE_ROOT"], env["STORAGE_ROOT"],
] + get_duplicity_additional_args(env), get_duplicity_env_vars(env)) ], get_duplicity_env_vars(env))
def run_duplicity_restore(args): def run_duplicity_restore(args):
env = load_environment() env = load_environment()
@ -408,9 +413,10 @@ def run_duplicity_restore(args):
"/usr/bin/duplicity", "/usr/bin/duplicity",
"restore", "restore",
"--archive-dir", backup_cache_dir, "--archive-dir", backup_cache_dir,
get_duplicity_target_url(config), ] + get_duplicity_additional_args(env) + [
] + get_duplicity_additional_args(env) + args, get_duplicity_target_url(config)
get_duplicity_env_vars(env)) ] + args,
get_duplicity_env_vars(env))
def list_target_files(config): def list_target_files(config):
import urllib.parse import urllib.parse