fix #4591: pbs-client: backup_writer: improve error reporting

We check if the manifest contains an index for the requested archive, if
it does not we avoid downloading it and report a more helpful error
message.

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
This commit is contained in:
Maximiliano Sandoval 2023-06-07 16:07:01 +02:00 committed by Fabian Grünbichler
parent 288893a6a9
commit 03e71cc8be

View File

@ -284,33 +284,41 @@ impl BackupWriter {
let close_path = format!("{}_close", prefix);
if let Some(manifest) = options.previous_manifest {
// try, but ignore errors
match ArchiveType::from_path(archive_name) {
Ok(ArchiveType::FixedIndex) => {
if let Err(err) = self
.download_previous_fixed_index(
archive_name,
&manifest,
known_chunks.clone(),
)
.await
{
log::warn!("Error downloading .fidx from previous manifest: {}", err);
if !manifest
.files()
.iter()
.any(|file| file.filename == archive_name)
{
log::info!("There is no index with the name {archive_name}");
} else {
// try, but ignore errors
match ArchiveType::from_path(archive_name) {
Ok(ArchiveType::FixedIndex) => {
if let Err(err) = self
.download_previous_fixed_index(
archive_name,
&manifest,
known_chunks.clone(),
)
.await
{
log::warn!("Error downloading .fidx from previous manifest: {}", err);
}
}
}
Ok(ArchiveType::DynamicIndex) => {
if let Err(err) = self
.download_previous_dynamic_index(
archive_name,
&manifest,
known_chunks.clone(),
)
.await
{
log::warn!("Error downloading .didx from previous manifest: {}", err);
Ok(ArchiveType::DynamicIndex) => {
if let Err(err) = self
.download_previous_dynamic_index(
archive_name,
&manifest,
known_chunks.clone(),
)
.await
{
log::warn!("Error downloading .didx from previous manifest: {}", err);
}
}
_ => { /* do nothing */ }
}
_ => { /* do nothing */ }
}
}