cmd: add repeat config option to Prune

This commit is contained in:
Christian Schwarz 2017-09-01 16:45:43 +02:00
parent 8a96267ef4
commit e048386cd5
2 changed files with 10 additions and 0 deletions

View File

@ -68,6 +68,7 @@ type Prune struct {
DatasetFilter zfs.DatasetFilter
SnapshotFilter zfs.FilesystemVersionFilter
RetentionPolicy *RetentionGrid // TODO abstract interface to support future policies?
Repeat jobrun.RepeatStrategy
}
type Autosnap struct {
@ -499,6 +500,7 @@ func parsePrune(e map[string]interface{}, name string) (prune *Prune, err error)
Grid string
DatasetFilter map[string]string `mapstructure:"dataset_filter"`
SnapshotFilter map[string]string `mapstructure:"snapshot_filter"`
Repeat map[string]string
}
if err = mapstructure.Decode(e, &i); err != nil {
@ -540,6 +542,12 @@ func parsePrune(e map[string]interface{}, name string) (prune *Prune, err error)
return
}
// Parse repeat strategy
if prune.Repeat, err = parseRepeatStrategy(i.Repeat); err != nil {
err = fmt.Errorf("cannot parse repeat strategy: %s", err)
return
}
return
}

View File

@ -95,6 +95,8 @@ prune:
snapshot_filter: {
prefix: zrepl_hfbak_
}
repeat:
interval: 10s
autosnap: