could work as is.
This commit is contained in:
@@ -8,4 +8,5 @@ sshfolder=path to the .ssh folder to use
|
|||||||
remotehost=
|
remotehost=
|
||||||
repository=
|
repository=
|
||||||
passwordfile=
|
passwordfile=
|
||||||
dryrun=
|
dryrun=
|
||||||
|
|
||||||
|
|||||||
7
main.py
7
main.py
@@ -89,13 +89,18 @@ def restic_backup(dirpath: str, tagslist: list = None):
|
|||||||
if arguments.dryrun:
|
if arguments.dryrun:
|
||||||
dryrun = "--dry-run"
|
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'},
|
volumes = {dirpath: {'bind': dirpath, 'mode': 'ro'},
|
||||||
arguments.sshfolder: {'bind': '/root/.ssh', 'mode': 'ro'},
|
arguments.sshfolder: {'bind': '/root/.ssh', 'mode': 'ro'},
|
||||||
arguments.passwordfile: {'bind': "/repopassword", 'mode': 'ro'}}
|
arguments.passwordfile: {'bind': "/repopassword", 'mode': 'ro'}}
|
||||||
command = f"backup {dryrun} {tagscommand} {dirpath}"
|
command = f"backup {dryrun} {tagscommand} {dirpath}"
|
||||||
hostname = "restic"
|
hostname = "restic"
|
||||||
environment = ["RESTIC_PASSWORD_FILE=/repopassword",
|
environment = ["RESTIC_PASSWORD_FILE=/repopassword",
|
||||||
f"RESTIC_REPOSITORY={arguments.repository}"]
|
f"RESTIC_REPOSITORY={repo}"]
|
||||||
|
|
||||||
dockerhost.containers.run("restic/restic", command=command, environment=environment,
|
dockerhost.containers.run("restic/restic", command=command, environment=environment,
|
||||||
volumes=volumes, remove=True, hostname=hostname)
|
volumes=volumes, remove=True, hostname=hostname)
|
||||||
|
|||||||
Reference in New Issue
Block a user