diff --git a/kopia_backup/templates/kopia-backup.j2 b/kopia_backup/templates/kopia-backup.j2 index c71c73f..43b1cd9 100644 --- a/kopia_backup/templates/kopia-backup.j2 +++ b/kopia_backup/templates/kopia-backup.j2 @@ -53,11 +53,11 @@ ignore {{ i.key | quote }} {{ i.value | map('quote') | join(' ') }} {% set retentions = kopia_backup.retention | default({}) | dict2items | rejectattr('value', 'none') | list %} {% if retentions %} -# Per-source retention overrides, applied as a whole (--clear-retention runs after the keep flags within one call). +# Per-source retention overrides, applied as a whole. A keep flag of 0 means "inherit", +# so setting all four flags explicitly fully defines the retention for the path. retention() { local path=$1; shift - kopia policy set "$path" --clear-retention >/dev/null 2>&1 && - kopia policy set "$path" "$@" >/dev/null 2>&1 || + kopia policy set "$path" "$@" >/dev/null 2>&1 || { echo "setting the retention of $path failed" >&2; failed=1; } } {% for r in retentions %}