From 0052dc6d28bb3775cdba05fcfdfefafa2942f41b Mon Sep 17 00:00:00 2001 From: Dominik Csapak Date: Fri, 16 Jul 2021 10:53:24 +0200 Subject: [PATCH] server/prune_job: add 'keep_all' logic to 'prune_datastore' it is the same as when pruning single groups. for prune_jobs, we never start the worker if there is no prune option set. but if we want to call 'prune_datastore' from somewhere else, we have to check it here again Signed-off-by: Dominik Csapak --- src/server/prune_job.rs | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/server/prune_job.rs b/src/server/prune_job.rs index 7ea42fcb..40ed555f 100644 --- a/src/server/prune_job.rs +++ b/src/server/prune_job.rs @@ -19,11 +19,17 @@ pub fn prune_datastore( ) -> Result<(), Error> { task_log!(worker, "Starting datastore prune on store \"{}\"", store); - task_log!( - worker, - "retention options: {}", - prune_options.cli_options_string() - ); + let keep_all = !prune_options.keeps_something(); + + if keep_all { + task_log!(worker, "No prune selection - keeping all files."); + } else { + task_log!( + worker, + "retention options: {}", + prune_options.cli_options_string() + ); + } let base_path = datastore.base_path(); @@ -41,7 +47,8 @@ pub fn prune_datastore( group.backup_id() ); - for (info, keep) in prune_info { + for (info, mut keep) in prune_info { + if keep_all { keep = true; } task_log!( worker, "{} {}/{}/{}",