From 8da0ae0ec8ac7e71f2104af8aab0770db7c4d25d Mon Sep 17 00:00:00 2001 From: Fabien BOURGEOIS Date: Sat, 13 Mar 2021 08:31:38 +0100 Subject: [PATCH] [FIX]RsyncVolumes : fix empty word exclusion --- backups/rsyncvolumes/plan.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/backups/rsyncvolumes/plan.py b/backups/rsyncvolumes/plan.py index d62d6cc..473f1ae 100644 --- a/backups/rsyncvolumes/plan.py +++ b/backups/rsyncvolumes/plan.py @@ -27,15 +27,18 @@ zippath = DEST + zipname # Zip files -EXCLUDE_WORDS = environ.get('EXCLUDE_WORDS', '') -EXCLUDE_WORDS = EXCLUDE_WORDS.split(',') +EXCLUDE_WORDS = environ.get('EXCLUDE_WORDS', False) +if EXCLUDE_WORDS: + EXCLUDE_WORDS = EXCLUDE_WORDS.split(',') def zipdir(path, ziph): # ziph is zipfile handle 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')