Check --keep-newer-than before the backup starts (closes #307)
check / check (push) Waiting to run
check / check (push) Waiting to run
snapshot create read --keep-newer-than only in the post-backup prune, so a value the duration parser rejects failed the run after the snapshot was uploaded: a nightly cron line added a snapshot each night, reported it as failed, and never deleted any. Without --prune the flag was ignored. CreateSnapshot now checks it first and fails, before anything is backed up, on an invalid duration or a missing --prune. A failed post-backup prune is now wrapped in ErrPostBackupPruneFailed and reported as "Backup completed, but post-backup prune failed: ..." rather than as a failed snapshot creation. The exit status stays 1. Model: opus-5-5
This commit is contained in:
@@ -97,6 +97,13 @@ on Linux), then /etc/vaultik/config.yml.`,
|
||||
}, func(v *vaultik.Vaultik) error {
|
||||
return v.CreateSnapshot(opts)
|
||||
}, func(err error) {
|
||||
if errors.Is(err, vaultik.ErrPostBackupPruneFailed) {
|
||||
log.Error("Post-backup prune failed", "error", err)
|
||||
ReportErrorf("Backup completed, but %v", err)
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
log.Error("Snapshot creation failed", "error", err)
|
||||
ReportErrorf("Snapshot creation failed: %v", err)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user