This commit is contained in:
Simon 2024-11-05 20:33:24 +00:00 committed by GitHub
commit 19eae96ef2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 16 additions and 8 deletions

View File

@ -19,14 +19,15 @@ type BackendRest struct {
}
type Backend struct {
name string
Type string `mapstructure:"type,omitempty" yaml:"type,omitempty"`
Path string `mapstructure:"path,omitempty" yaml:"path,omitempty"`
Key string `mapstructure:"key,omitempty" yaml:"key,omitempty"`
RequireKey bool `mapstructure:"requireKey,omitempty" yaml:"requireKey,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"`
name string
Type string `mapstructure:"type,omitempty" yaml:"type,omitempty"`
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"`
}
func GetBackend(name string) (Backend, bool) {

View File

@ -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