From e048386cd51aa6cd60f24f04dafd054b1546b4ce Mon Sep 17 00:00:00 2001 From: Christian Schwarz Date: Fri, 1 Sep 2017 16:45:43 +0200 Subject: [PATCH] cmd: add repeat config option to Prune --- cmd/config.go | 8 ++++++++ cmd/sampleconf/zrepl.yml | 2 ++ 2 files changed, 10 insertions(+) diff --git a/cmd/config.go b/cmd/config.go index e017d8a..4dde920 100644 --- a/cmd/config.go +++ b/cmd/config.go @@ -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 } diff --git a/cmd/sampleconf/zrepl.yml b/cmd/sampleconf/zrepl.yml index e4b8321..d683caf 100644 --- a/cmd/sampleconf/zrepl.yml +++ b/cmd/sampleconf/zrepl.yml @@ -95,6 +95,8 @@ prune: snapshot_filter: { prefix: zrepl_hfbak_ } + repeat: + interval: 10s autosnap: