[FIX]RsyncVolumes : fix empty word exclusion

This commit is contained in:
Fabien BOURGEOIS 2021-03-13 08:31:38 +01:00
parent 396da4393b
commit 8da0ae0ec8

View File

@ -27,15 +27,18 @@ zippath = DEST + zipname
# Zip files # Zip files
EXCLUDE_WORDS = environ.get('EXCLUDE_WORDS', '') EXCLUDE_WORDS = environ.get('EXCLUDE_WORDS', False)
EXCLUDE_WORDS = EXCLUDE_WORDS.split(',') if EXCLUDE_WORDS:
EXCLUDE_WORDS = EXCLUDE_WORDS.split(',')
def zipdir(path, ziph): def zipdir(path, ziph):
# ziph is zipfile handle # ziph is zipfile handle
for root, dirs, files in walk(path): for root, dirs, files in walk(path):
for file in files: for file in files:
pfile = osjoin(root, file) pfile = osjoin(root, file)
if isfile(pfile) and all(map(lambda w: w not in pfile, EXCLUDE_WORDS)): if (isfile(pfile)
and EXCLUDE_WORDS
and all(map(lambda w: w not in pfile, EXCLUDE_WORDS))):
ziph.write(pfile) ziph.write(pfile)
print('Compression started') print('Compression started')