Add allowFailure option

Implements #189
pull/408/head
simonhammes 4 weeks ago
parent f7d28b486c
commit a33b782c54

@ -24,6 +24,7 @@ type Backend struct {
Path string `mapstructure:"path,omitempty" yaml:"path,omitempty"`
Key string `mapstructure:"key,omitempty" yaml:"key,omitempty"`
RequireKey bool `mapstructure:"requireKey,omitempty" yaml:"requireKey,omitempty"`
AllowFailure bool `mapstructure:"allowFailure,omitempty" yaml:"allowFailure,omitempty"`
Env map[string]string `mapstructure:"env,omitempty" yaml:"env,omitempty"`
Rest BackendRest `mapstructure:"rest,omitempty" yaml:"rest,omitempty"`
Options Options `mapstructure:"options,omitempty" yaml:"options,omitempty"`

@ -267,6 +267,13 @@ func (l Location) Backup(cron bool, specificBackend string) []error {
// If error save it and continue
if err != nil {
if backend.AllowFailure {
colors.Faint.Printf("skipping backend \"%s\" since allowFailure was set to \"true\"\n", to)
if flags.VERBOSE {
colors.Error.Printf("reason: %s", out)
}
continue
}
colors.Error.Println(out)
errors = append(errors, fmt.Errorf("%s@%s:\n%s%s", l.name, backend.name, out, err))
continue

Loading…
Cancel
Save