From 84c2cb6c1fd1a4874ecfdf46d4fdfb26d77de551 Mon Sep 17 00:00:00 2001 From: simonsan <14062932+simonsan@users.noreply.github.com> Date: Wed, 4 Dec 2024 11:54:46 +0100 Subject: [PATCH] fix backup source handling in case sanitizing fails Signed-off-by: simonsan <14062932+simonsan@users.noreply.github.com> --- src/commands/backup.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/commands/backup.rs b/src/commands/backup.rs index 86f335af8..bc4060684 100644 --- a/src/commands/backup.rs +++ b/src/commands/backup.rs @@ -208,7 +208,10 @@ impl BackupCmd { }) .collect(); - let snapshot_sources = match (self.cli_sources.is_empty(), snapshot_opts.is_empty()) { + let snapshot_sources = match ( + self.cli_sources.is_empty(), + config_snapshot_sources.is_empty(), + ) { (false, _) => { let item = PathList::from_iter(&self.cli_sources).sanitize()?; vec![item] @@ -218,12 +221,9 @@ impl BackupCmd { config_snapshot_sources.clone() } (true, true) => { - bail!("no backup source given."); + bail!("No usable backup source. Please make sure that the given sources are valid."); } }; - if snapshot_sources.is_empty() { - return Ok(()); - } let mut is_err = false; for sources in snapshot_sources { @@ -239,6 +239,7 @@ impl BackupCmd { is_err = true; } } + if is_err { Err(anyhow!("Not all snapshots were generated successfully!")) } else {