[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,7 +27,8 @@ zippath = DEST + zipname
# Zip files
EXCLUDE_WORDS = environ.get('EXCLUDE_WORDS', '')
EXCLUDE_WORDS = environ.get('EXCLUDE_WORDS', False)
if EXCLUDE_WORDS:
EXCLUDE_WORDS = EXCLUDE_WORDS.split(',')
def zipdir(path, ziph):
@ -35,7 +36,9 @@ def zipdir(path, ziph):
for root, dirs, files in walk(path):
for file in files:
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)
print('Compression started')