resticprofile icon indicating copy to clipboard operation
resticprofile copied to clipboard

[Feature request] Add flag to continue group backup if one or more profiles return with error

Open legg681 opened this issue 3 years ago • 3 comments

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 👍

legg681 avatar Aug 25 '22 16:08 legg681

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.

creativeprojects avatar Aug 26 '22 18:08 creativeprojects

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?

legg681 avatar Aug 27 '22 07:08 legg681

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.

creativeprojects avatar Aug 27 '22 12:08 creativeprojects

Here's the proposal:

  • add one global flag group-continue-on-error in configuration file format v1
  • add one group flag continue-on-error in configuration format v2

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:

creativeprojects avatar Nov 07 '22 21:11 creativeprojects

Should we name it continue-on-error?

jkellerer avatar Nov 07 '22 21:11 jkellerer

Do you prefer continue-on-error? I don't mind either way

creativeprojects avatar Nov 07 '22 21:11 creativeprojects

Just thought continue is a more common term for such a behavior (even the pr is called like this :))

jkellerer avatar Nov 07 '22 21:11 jkellerer

Right you have a point 😛

creativeprojects avatar Nov 07 '22 21:11 creativeprojects

Just tried it out, works perfectly. Thanks all! 😃

legg681 avatar Nov 14 '22 15:11 legg681