From 973d5487a018a02b9b9b64454ffcca52e1d9971f Mon Sep 17 00:00:00 2001 From: Sora Date: Mon, 13 Nov 2023 00:52:45 +0100 Subject: [PATCH] hmmmm --- main.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/main.py b/main.py index f7c8abb..81c77c2 100644 --- a/main.py +++ b/main.py @@ -1,6 +1,6 @@ import os.path import docker -import restic +import socket import yaml import configparser import argparse @@ -98,12 +98,11 @@ def restic_backup(dirpath: str, tagslist: list = None): 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={repo}"] dockerhost.containers.run("restic/restic", command=command, environment=environment, - volumes=volumes, remove=True, hostname=hostname) + volumes=volumes, remove=True, hostname=socket.gethostname()) def yaml_to_services_list(filepath: str) -> dict|None: @@ -199,7 +198,10 @@ def backup_services(servicename: str, servicesdict: dict, composefilepath: str) if len(servicesdict[servicename]["must_before"]): for dependencie in servicesdict[servicename]["must_before"]: - backup_services(dependencie, servicesdict, composefilepath) + if arguments.bindexclude not in ("", None) and dependencie.find(arguments.bindexclude) != -1: + continue + elif arguments.bindinclude not in ("", None) and dependencie.find(arguments.bindinclude): + backup_services(dependencie, servicesdict, composefilepath) # TODO: faire la sauvegarde for containerid in containersid: