enzingerm / snapborg

Synchronize snapper snapshots to a borg repository
GNU General Public License v3.0
31 stars 5 forks source link

Prevent pruning of snapshots without an associated cleanup policy from borg archive #15

Open jrabinow opened 2 years ago

jrabinow commented 2 years ago

Solves #13

This PR changes the naming convention to depend on snapper cleanup policy for the snapshot. If there is any associated cleanup policy, the backup's name will start with snapborg_retentionpolicy_

Only backups whose name start with snapborg_retentionpolicy_ will be pruned, snapborg prune will ignore all others. In case this is undesired, an additional flag --ignore-nameprefix-warning-this-is-permanent exists to apply pruning to all backups in the archive. This PR also comes with a --noconfirm flag to bypass the confirmation prompt associated with applying pruning to all snapshots.

The reasoning here is that when users manually create snapshots (-> no backup policy), it must be because the system state was of interest. It's therefore worthwhile backing up that snapshot and keeping it indefinitely - or at least until the user manually deletes it.

I'm unsure if this is compatible with your personal use case - would it be better to NOT have this behavior by default, but instead to implement this functionality as an additional field in the snapper userdata that the user can manually specify?