In Python, not [] evaluates to True. When the snapshots argument to the prevent_cleanup function is an empty list (which is not None), if not snapshots would prevent every snapshot's clean-up. The output of snapborg --dryrun backup clearly shows this:
These Snapper invocations are redundant, as only snapshots that are selected for backup need clean-up prevention during Borg execution. This commit eliminates these redundant Snapper invocations.
Good catch and thanks for this PR! As I see this, this would only be the case when snapborg is invoked with no new snapshots to backup, but nevertheless!
In Python,
not []
evaluates toTrue
. When thesnapshots
argument to theprevent_cleanup
function is an empty list (which is notNone
),if not snapshots
would prevent every snapshot's clean-up. The output ofsnapborg --dryrun backup
clearly shows this:These Snapper invocations are redundant, as only snapshots that are selected for backup need clean-up prevention during Borg execution. This commit eliminates these redundant Snapper invocations.