could work as is.

This commit is contained in:
2023-11-12 16:50:13 +01:00
parent 78e41be752
commit 475cba3413
2 changed files with 8 additions and 2 deletions

View File

@@ -9,3 +9,4 @@ remotehost=
repository=
passwordfile=
dryrun=

View File

@@ -89,13 +89,18 @@ def restic_backup(dirpath: str, tagslist: list = None):
if arguments.dryrun:
dryrun = "--dry-run"
repo = arguments.remotehost
if repo.finds(":") != -1:
repo = f"{repo}//{arguments.repository}"
else
repo = f"{repo}:/{arguments.repository}"
volumes = {dirpath: {'bind': dirpath, 'mode': 'ro'},
arguments.sshfolder: {'bind': '/root/.ssh', 'mode': 'ro'},
arguments.passwordfile: {'bind': "/repopassword", 'mode': 'ro'}}
command = f"backup {dryrun} {tagscommand} {dirpath}"
hostname = "restic"
environment = ["RESTIC_PASSWORD_FILE=/repopassword",
f"RESTIC_REPOSITORY={arguments.repository}"]
f"RESTIC_REPOSITORY={repo}"]
dockerhost.containers.run("restic/restic", command=command, environment=environment,
volumes=volumes, remove=True, hostname=hostname)