fix backup source handling in case sanitizing fails

Signed-off-by: simonsan <14062932+simonsan@users.noreply.github.com>
This commit is contained in:
simonsan 2024-12-04 11:54:46 +01:00
parent f565eea1f6
commit 84c2cb6c1f
No known key found for this signature in database
GPG Key ID: E11D13668EC3B71B

View File

@ -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 {