From b52efea18e02840a56046936f6b3a76e44d8c946 Mon Sep 17 00:00:00 2001 From: Lammert Hellinga Date: Thu, 5 Aug 2021 10:00:42 +0200 Subject: [PATCH] Add if around exclude options to prevent yaml error. By @Kogelvis (#72) --- templates/config.yaml.j2 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/templates/config.yaml.j2 b/templates/config.yaml.j2 index a5bcf27..f77fd61 100644 --- a/templates/config.yaml.j2 +++ b/templates/config.yaml.j2 @@ -23,19 +23,23 @@ location: # Store ctime into archive. ctime: {{ borgmatic_store_ctime }} +{% if borg_exclude_patterns|length %} # Any paths matching these patterns are excluded from backups. Globs and tildes # are expanded. See the output of "borg help patterns" for more details. exclude_patterns: {% for dir in borg_exclude_patterns %} - '{{ dir }}' {% endfor %} +{% endif %} +{% if borg_exclude_from|length %} # Read exclude patterns from one or more separate named files, one pattern per # line. See the output of "borg help patterns" for more details. exclude_from: {% for dir in borg_exclude_from %} - {{ dir }} {% endfor %} +{% endif %} # Exclude directories that contain a CACHEDIR.TAG file. See # http://www.brynosaurus.com/cachedir/spec.html for details.