resticprofile icon indicating copy to clipboard operation
resticprofile copied to clipboard

resticprofile lock fail will not trigger `sent-after-fail`

Open http403 opened this issue 2 years ago • 5 comments

Version

resticprofile: 0.22.0 commit ddf9debf89960db2c6139523ef6140a6538c5d27 restic: 0.15.2 compiled with go1.20.3 on windows/amd64 Windows: 10 22H2 Build 19045

Problem

If a resticprofile lock exists and execute a backup, the failure will not reported via sent-after-fail.

Step to reproduce (not 100%)

  1. Configure sent-after-fail on backup
  2. Execute backup while lock still exist

Expected bahavior

Report the fail via sent-after-fail

Actual bahavior

Slient fail

Workaround

None

http403 avatar Aug 03 '23 16:08 http403

Hi,

I haven't thought about it before, but now I can see this problem is a bit of a chicken and egg issue.

For now all the send- operations run at the same time as the run- operations.

So the expectation here is that the run-before and run-after or run-finally are protected inside the lock: Imagine for example connecting a network drive or mounting a USB disk for the duration of the backup. The lock needs to be set first (and released last).

Now I can see why we would want the send- operations to go first (and last), before and after the lock, hence being disconnected from the run- operations.

Now the question is, would any other user workflow be impacted by changing this behaviour?

🤔

creativeprojects avatar Aug 04 '23 19:08 creativeprojects

On the other hand, the issue only happens for local lock failures or any other pre-condition check (e.g. not enough free ram). It is a special case of error and it might be problematic if we trigger actions using the current configs, since "*-after-fail" currently means that an external command failed.

Maybe accept the limitation or provide a separate config like (run|send)-after-precondition-failed in profile?

jkellerer avatar Aug 05 '23 14:08 jkellerer

Adding another layer is probably best for functionality, but it starts to make things really complicated in the configuration file 😆

The preconditions that are not included in the run-* and send-* are :

  • not enough memory
  • cannot find restic binary
  • resticprofile lock
  • computer running on battery #235

creativeprojects avatar Aug 05 '23 15:08 creativeprojects

Agree.. it gets a bit complicated.

Fixing will require some refactoring. E.g. pass the precondition failure (which needs to be collected for all cases) to the runner (or wrapper) so that it can fail before doing anything else.

jkellerer avatar Aug 05 '23 15:08 jkellerer

I've added a note to the documentation until we find a reasonable workaround #245

creativeprojects avatar Aug 11 '23 15:08 creativeprojects