could work as is.
This commit is contained in:
@@ -8,4 +8,5 @@ sshfolder=path to the .ssh folder to use
|
||||
remotehost=
|
||||
repository=
|
||||
passwordfile=
|
||||
dryrun=
|
||||
dryrun=
|
||||
|
||||
|
||||
7
main.py
7
main.py
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user