adding *better* filtering
This commit is contained in:
19
main.py
19
main.py
@@ -198,12 +198,6 @@ def backup_services(servicename: str, servicesdict: dict, composefilepath: str)
|
|||||||
|
|
||||||
if len(servicesdict[servicename]["must_before"]):
|
if len(servicesdict[servicename]["must_before"]):
|
||||||
for dependencie in servicesdict[servicename]["must_before"]:
|
for dependencie in servicesdict[servicename]["must_before"]:
|
||||||
if arguments.bindexclude not in ("", None) and dependencie.find(arguments.bindexclude) != -1:
|
|
||||||
# on a un filtre d'exclusion et il matche, donc on ne backup pas
|
|
||||||
continue
|
|
||||||
elif arguments.bindinclude not in ("", None) and dependencie.find(arguments.bindinclude) != -1:
|
|
||||||
#on a un filtre d'inclusion et il ne matche pas, donc on ne backup pas
|
|
||||||
continue
|
|
||||||
backup_services(dependencie, servicesdict, composefilepath)
|
backup_services(dependencie, servicesdict, composefilepath)
|
||||||
|
|
||||||
# TODO: faire la sauvegarde
|
# TODO: faire la sauvegarde
|
||||||
@@ -212,8 +206,17 @@ def backup_services(servicename: str, servicesdict: dict, composefilepath: str)
|
|||||||
if "Binds" in container.attrs["HostConfig"] and len(container.attrs["HostConfig"]["Binds"]):
|
if "Binds" in container.attrs["HostConfig"] and len(container.attrs["HostConfig"]["Binds"]):
|
||||||
for bind in container.attrs["HostConfig"]["Binds"]:
|
for bind in container.attrs["HostConfig"]["Binds"]:
|
||||||
bindpath = bind.split(":")[0]
|
bindpath = bind.split(":")[0]
|
||||||
print(f" backup of {bindpath}")
|
if arguments.bindexclude not in ("", None) and dependencie.find(
|
||||||
restic_backup(dirpath=bindpath, tagslist=[servicename])
|
arguments.bindexclude) != -1:
|
||||||
|
# on a un filtre d'exclusion et il matche, donc on ne backup pas
|
||||||
|
pass
|
||||||
|
elif arguments.bindinclude not in ("", None) and dependencie.find(
|
||||||
|
arguments.bindinclude) != -1:
|
||||||
|
# on a un filtre d'inclusion et il ne matche pas, donc on ne backup pas
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
print(f" backup of {bindpath}")
|
||||||
|
restic_backup(dirpath=bindpath, tagslist=[servicename])
|
||||||
|
|
||||||
for containerindex in range(0, len(containersid)):
|
for containerindex in range(0, len(containersid)):
|
||||||
if containerrunning[containerindex]:
|
if containerrunning[containerindex]:
|
||||||
|
|||||||
Reference in New Issue
Block a user