From ad53c1d6ddea95ca78ca0d40358a3eaa1211ea29 Mon Sep 17 00:00:00 2001 From: Thomas Lamprecht Date: Fri, 6 Nov 2020 14:08:01 +0100 Subject: [PATCH] api: datastore: allow to set "verify-new" option over API Until now, one could only set this by editing the configuration file manually. Signed-off-by: Thomas Lamprecht --- src/api2/config/datastore.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/api2/config/datastore.rs b/src/api2/config/datastore.rs index ea3c3776..4ca4bf0e 100644 --- a/src/api2/config/datastore.rs +++ b/src/api2/config/datastore.rs @@ -196,6 +196,8 @@ pub enum DeletableProperty { keep_monthly, /// Delete the keep-yearly property keep_yearly, + /// Delete the verify-new property + verify_new, /// Delete the notify-user property notify_user, /// Delete the notify property @@ -253,6 +255,12 @@ pub enum DeletableProperty { optional: true, schema: PRUNE_SCHEMA_KEEP_YEARLY, }, + "verify-new": { + description: "If enabled, all new backups will be verified right after completion.", + type: bool, + optional: true, + default: false, + }, delete: { description: "List of properties to delete.", type: Array, @@ -283,6 +291,7 @@ pub fn update_datastore( keep_weekly: Option, keep_monthly: Option, keep_yearly: Option, + verify_new: Option, notify: Option, notify_user: Option, delete: Option>, @@ -313,6 +322,7 @@ pub fn update_datastore( DeletableProperty::keep_weekly => { data.keep_weekly = None; }, DeletableProperty::keep_monthly => { data.keep_monthly = None; }, DeletableProperty::keep_yearly => { data.keep_yearly = None; }, + DeletableProperty::verify_new => { data.verify_new = None; }, DeletableProperty::notify => { data.notify = None; }, DeletableProperty::notify_user => { data.notify_user = None; }, } @@ -356,6 +366,8 @@ pub fn update_datastore( data.notify = Some(notify_str); } } + if verify_new.is_some() { data.verify_new = verify_new; } + if notify_user.is_some() { data.notify_user = notify_user; } config.set_data(&name, "datastore", &data)?;