hmmmm
This commit is contained in:
10
main.py
10
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:
|
||||
|
||||
Reference in New Issue
Block a user