[Feature request] Add flag to continue group backup if one or more profiles return with error
Hello, I'm trying to using resticprofile to back up some VMs, but this can only happen, if a VM is currently not running. Therefore I made a profile for each VM and added all profiles to a group, so I can back them up with one command.
To check if a VM is currently running I used the run-before backup command hook on each profile. A small script then checked the VM state and returned a non-zero exit code, if the VM is running. My hope was that only the corresponding profile would get skipped and resticprofile would continue with the next one, so all non-running VMs would get backed up, whilst skipping the other. However when a command hook returns a non-zero exit code the complete action is cancelled and all remaining profiles are not processed.
Suggestion: Because the new config file format #80 already was prepared to allow for more configuration of groups I think a flag like "on-error-continue-with-next" might be relatively easy to implement?
Thanks for the awesome work so far 👍
Thanks!
Yes I can add the option in the configuration file v2, or it would have to be in the global section, meaning it would work on all groups.
Sounds awesome, thanks 😄
Leveraging the additional flexibility of v2 and defining it per group would be superior in my option, so I would opt for this one. Also you would still able to simulate a global-like option through inheritance/mixins.
However, having at least a global option in config file v1 wouldn't hurt I guess? Are still changes being made to v1?
Yes, v1 is still the main supported version while we're working on v2.
Actually I don't think we would drop support for v1 for some time. If you're using a configuration in TOML, v1 is much more readable. v2 is more suited when using YAML.
The v2 configuration format is work in progress. We want to get it right so we won't need to create a v3 later 👍🏻 Most of the features are already there to be honest, except that the schedules don't work yet.
Here's the proposal:
- add one global flag
group-continue-on-errorin configuration file formatv1 - add one group flag
continue-on-errorin configuration formatv2
When setting the global flag group-continue-on-error to true, it allows the next profile(s) to run after a failing profile. Without the option all the following profiles are not started.
global:
group-continue-on-error: true
In a similar way on configuration file v2 you can set the continue-on-error on each group independently:
groups:
double:
continue-on-error: true
profiles:
- profile1
- profile2
profiles:
profile1:
profile2:
Should we name it continue-on-error?
Do you prefer continue-on-error? I don't mind either way
Just thought continue is a more common term for such a behavior (even the pr is called like this :))
Right you have a point 😛
Just tried it out, works perfectly. Thanks all! 😃