Skip to content

Commit a5af001

Browse files
committed
Add allowFailure option
Implements #189
1 parent 8a77385 commit a5af001

File tree

2 files changed

+16
-8
lines changed

2 files changed

+16
-8
lines changed

internal/backend.go

+9-8
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,15 @@ type BackendRest struct {
1919
}
2020

2121
type Backend struct {
22-
name string
23-
Type string `mapstructure:"type,omitempty"`
24-
Path string `mapstructure:"path,omitempty"`
25-
Key string `mapstructure:"key,omitempty"`
26-
RequireKey bool `mapstructure:"requireKey,omitempty"`
27-
Env map[string]string `mapstructure:"env,omitempty"`
28-
Rest BackendRest `mapstructure:"rest,omitempty"`
29-
Options Options `mapstructure:"options,omitempty"`
22+
name string
23+
Type string `mapstructure:"type,omitempty"`
24+
Path string `mapstructure:"path,omitempty"`
25+
Key string `mapstructure:"key,omitempty"`
26+
RequireKey bool `mapstructure:"requireKey,omitempty"`
27+
AllowFailure bool `mapstructure:"allowFailure,omitempty"`
28+
Env map[string]string `mapstructure:"env,omitempty"`
29+
Rest BackendRest `mapstructure:"rest,omitempty"`
30+
Options Options `mapstructure:"options,omitempty"`
3031
}
3132

3233
func GetBackend(name string) (Backend, bool) {

internal/location.go

+7
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,13 @@ func (l Location) Backup(cron bool, specificBackend string) []error {
267267

268268
// If error save it and continue
269269
if err != nil {
270+
if backend.AllowFailure {
271+
colors.Faint.Printf("skipping backend \"%s\" since allowFailure was set to \"true\"\n", to)
272+
if flags.VERBOSE {
273+
colors.Error.Printf("reason: %s", out)
274+
}
275+
continue
276+
}
270277
colors.Error.Println(out)
271278
errors = append(errors, fmt.Errorf("%s@%s:\n%s%s", l.name, backend.name, out, err))
272279
continue

0 commit comments

Comments
 (0)