Skip to content

Commit

Permalink
fix backup source handling in case sanitizing fails
Browse files Browse the repository at this point in the history
Signed-off-by: simonsan <[email protected]>
  • Loading branch information
simonsan committed Dec 4, 2024
1 parent f565eea commit 84c2cb6
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/commands/backup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -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 {
Expand All @@ -239,6 +239,7 @@ impl BackupCmd {
is_err = true;
}
}

if is_err {
Err(anyhow!("Not all snapshots were generated successfully!"))
} else {
Expand Down

0 comments on commit 84c2cb6

Please sign in to comment.