diff --git a/configuration.ini.example b/configuration.ini.example index e0bdda8..fac7749 100644 --- a/configuration.ini.example +++ b/configuration.ini.example @@ -8,4 +8,5 @@ sshfolder=path to the .ssh folder to use remotehost= repository= passwordfile= -dryrun= \ No newline at end of file +dryrun= + diff --git a/main.py b/main.py index 584a136..4cea48e 100644 --- a/main.py +++ b/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)