Add if around exclude options to prevent yaml error. By @Kogelvis (#72)

This commit is contained in:
Lammert Hellinga 2021-08-05 10:00:42 +02:00 committed by GitHub
parent cce04c3648
commit b52efea18e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -23,19 +23,23 @@ location:
# Store ctime into archive. # Store ctime into archive.
ctime: {{ borgmatic_store_ctime }} ctime: {{ borgmatic_store_ctime }}
{% if borg_exclude_patterns|length %}
# Any paths matching these patterns are excluded from backups. Globs and tildes # Any paths matching these patterns are excluded from backups. Globs and tildes
# are expanded. See the output of "borg help patterns" for more details. # are expanded. See the output of "borg help patterns" for more details.
exclude_patterns: exclude_patterns:
{% for dir in borg_exclude_patterns %} {% for dir in borg_exclude_patterns %}
- '{{ dir }}' - '{{ dir }}'
{% endfor %} {% endfor %}
{% endif %}
{% if borg_exclude_from|length %}
# Read exclude patterns from one or more separate named files, one pattern per # Read exclude patterns from one or more separate named files, one pattern per
# line. See the output of "borg help patterns" for more details. # line. See the output of "borg help patterns" for more details.
exclude_from: exclude_from:
{% for dir in borg_exclude_from %} {% for dir in borg_exclude_from %}
- {{ dir }} - {{ dir }}
{% endfor %} {% endfor %}
{% endif %}
# Exclude directories that contain a CACHEDIR.TAG file. See # Exclude directories that contain a CACHEDIR.TAG file. See
# http://www.brynosaurus.com/cachedir/spec.html for details. # http://www.brynosaurus.com/cachedir/spec.html for details.